src/Framework/Provider/RoutingServiceProvider.php
public function register(Container $app)
    {
        /**
         * Holds information about the current request
         *
         * @return RequestContext
         */
        $app['request_context'] = function () use ($app) {
            $context = new RequestContext();

            // set default http & https ports if not set
            $context->setHttpPort(isset($app['request.http_port']) ? $app['request.http_port'] : 80);
            $context->setHttpsPort(isset($app['request.https_port']) ? $app['request.https_port'] : 443);

            return $context;
        };

        /**
         * Matches URL based on a set of routes.
         *
         * @return UrlMatcher
         */
        $app['matcher'] = function () use ($app) {
          return new UrlMatcher($app['router'], $app['request_context']);
        };

        /**
         * Router
         */
        $options = array(
            'cache_dir' => true === $app['use_cache']
                    ? __DIR__ . '/' . self::CACHE_DIRECTORY
                    : null,
            'debug' => true
        );

        $app['router'] = function () use ($app, $options) {
             $router = new Router(
                $app['config.loader'],
                sprintf(self::CONFIG_ROUTES_FILE, $app['env']),
                $options
            );

            return $router->getRouteCollection();
        };
    }
public function register(Container $app)
    {
        /**
         * Holds information about the current request
         *
         * @return RequestContext
         */
        $app['request_context'] = function () use ($app) {
            $context = new RequestContext();

            // set default http & https ports if not set
            $context->setHttpPort(isset($app['request.http_port']) ? $app['request.http_port'] : 80);
            $context->setHttpsPort(isset($app['request.https_port']) ? $app['request.https_port'] : 443);

            return $context;
        };

        /**
         * Matches URL based on a set of routes.
         *
         * @return UrlMatcher
         */
        $app['matcher'] = function () use ($app) {
          return new UrlMatcher($app['router'], $app['request_context']);
        };

        /**
         * Router
         */
        $options = array(
            'cache_dir' => true === $app['use_cache']
                    ? __DIR__ . '/' . self::CACHE_DIRECTORY
                    : null,
            'debug' => true
        );

        $app['router'] = function () use ($app, $options) {
             $router = new Router(
                $app['config.loader'],
                sprintf(self::CONFIG_ROUTES_FILE, $app['env']),
                $options
            );

            return $router->getRouteCollection();
        };
    }
{@inheritdoc}