src/Vectorface/SnappyRouter/Handler/PatternMatchHandler.php
private function getDispatcher($routes)
    {
        $verbs = self::$allHttpVerbs;
        $f = function (RouteCollector $collector) use ($routes, $verbs) {
            foreach ($routes as $pattern => $route) {
                if (is_array($route)) {
                    foreach ($route as $verb => $callback) {
                        $collector->addRoute(strtoupper($verb), $pattern, $callback);
                    }
                } else {
                    foreach ($verbs as $verb) {
                        $collector->addRoute($verb, $pattern, $route);
                    }
                }
            }
        };

        $options = $this->getOptions();
        $cacheData = array();
        if (isset($options[self::KEY_CACHE])) {
            $cacheData = (array)$options[self::KEY_CACHE];
        }

        if (empty($cacheData)) {
            return \FastRoute\simpleDispatcher($f);
        } else {
            return \FastRoute\cachedDispatcher($f, $cacheData);
        }
    }
private function getDispatcher($routes)
    {
        $verbs = self::$allHttpVerbs;
        $f = function (RouteCollector $collector) use ($routes, $verbs) {
            foreach ($routes as $pattern => $route) {
                if (is_array($route)) {
                    foreach ($route as $verb => $callback) {
                        $collector->addRoute(strtoupper($verb), $pattern, $callback);
                    }
                } else {
                    foreach ($verbs as $verb) {
                        $collector->addRoute($verb, $pattern, $route);
                    }
                }
            }
        };

        $options = $this->getOptions();
        $cacheData = array();
        if (isset($options[self::KEY_CACHE])) {
            $cacheData = (array)$options[self::KEY_CACHE];
        }

        if (empty($cacheData)) {
            return \FastRoute\simpleDispatcher($f);
        } else {
            return \FastRoute\cachedDispatcher($f, $cacheData);
        }
    }
private function getDispatcher ( $ routes ) { $ verbs = self :: $ allHttpVerbs ; $ f = function ( RouteCollector $ collector ) use ( $ routes , $ verbs ) { foreach ( $ routes as $ pattern => $ route ) { if ( is_array ( $ route ) ) { foreach ( $ route as $ verb => $ callback ) { $ collector -> addRoute ( strtoupper ( $ verb ) , $ pattern , $ callback ) ; } } else { foreach ( $ verbs as $ verb ) { $ collector -> addRoute ( $ verb , $ pattern , $ route ) ; } } } } ; $ options = $ this -> getOptions ( ) ; $ cacheData = array ( ) ; if ( isset ( $ options [ self :: KEY_CACHE ] ) ) { $ cacheData = ( array ) $ options [ self :: KEY_CACHE ] ; } if ( empty ( $ cacheData ) ) { return \ FastRoute \ simpleDispatcher ( $ f ) ; } else { return \ FastRoute \ cachedDispatcher ( $ f , $ cacheData ) ; } }
Returns an instance of the FastRoute dispatcher.
@param array $routes The array of specified routes.
@return FastRoute\Dispatcher The dispatcher to use.
Returns an instance of the FastRoute dispatcher .