getMiddlewareStack()); if ($lastSegment === null) { return null; } $callable = $lastSegment->getCallable(); $class = null; $method = null; if (is_array($callable) && count($callable) === 2) { [$class, $method] = $callable; } elseif (is_string($callable)) { // Handle the case where the callable is a string (e.g., 'ClassName::methodName') [$class, $method] = explode('::', $callable); } return [$class, $method]; } }