Airship\Engine\AutoPilot::route PHP Method

route() public method

Actually serve the HTTP request
public route ( )
    public function route()
    {
        $this->loadInjectedRoutes();
        $args = [];
        foreach ($this->cabin['data']['routes'] as $path => $landing) {
            $path = self::makePath($path);
            if (self::testLanding($path, $_SERVER['REQUEST_URI'], $args)) {
                self::$mypath = $path;
                self::$path = Binary::safeSubstr($_SERVER['REQUEST_URI'], Binary::safeStrlen(self::$patternPrefix) + 1);
                try {
                    // Attempt to serve the page:
                    return $this->serve($landing, \array_slice($args, 1));
                } catch (EmulatePageNotFound $ex) {
                    // If this exception is throw, we will attempt to serve
                    // the fallback route (which might end up with a 404 page)
                    return $this->serveFallback();
                }
            }
        }
        return $this->serveFallback();
    }