public function dispatch($method = null, $path = null)
    {
        $match = $this->getMatch($method, $path);

        foreach ($match->before as $filter) {
            if (empty($filter)) {
                continue;
            }
            $response = $this->executeCallback($this->getFilterCallback($filter), $match->args, true);
            if (!is_null($response)) {
                return $response;
            }
        }

        $routeResponse = $this->executeCallback($match->callback, $match->args);

        foreach ($match->after as $filter) {
            if (empty($filter)) {
                continue;
            }
            array_unshift($match->args, $routeResponse);
            $response = $this->executeCallback($this->getFilterCallback($filter), $match->args, true);
            if (!is_null($response)) {
                return $response;
            }
        }

        return $routeResponse;
    }
public function dispatch($method = null, $path = null)
    {
        $match = $this->getMatch($method, $path);

        foreach ($match->before as $filter) {
            if (empty($filter)) {
                continue;
            }
            $response = $this->executeCallback($this->getFilterCallback($filter), $match->args, true);
            if (!is_null($response)) {
                return $response;
            }
        }

        $routeResponse = $this->executeCallback($match->callback, $match->args);

        foreach ($match->after as $filter) {
            if (empty($filter)) {
                continue;
            }
            array_unshift($match->args, $routeResponse);
            $response = $this->executeCallback($this->getFilterCallback($filter), $match->args, true);
            if (!is_null($response)) {
                return $response;
            }
        }

        return $routeResponse;
    }
public function dispatch ( $ method = null , $ path = null ) { $ match = $ this -> getMatch ( $ method , $ path ) ; foreach ( $ match -> before as $ filter ) { if ( empty ( $ filter ) ) { continue ; } $ response = $ this -> executeCallback ( $ this -> getFilterCallback ( $ filter ) , $ match -> args , true ) ; if ( ! is_null ( $ response ) ) { return $ response ; } } $ routeResponse = $ this -> executeCallback ( $ match -> callback , $ match -> args ) ; foreach ( $ match -> after as $ filter ) { if ( empty ( $ filter ) ) { continue ; } array_unshift ( $ match -> args , $ routeResponse ) ; $ response = $ this -> executeCallback ( $ this -> getFilterCallback ( $ filter ) , $ match -> args , true ) ; if ( ! is_null ( $ response ) ) { return $ response ; } } return $ routeResponse ; }
Get matching route and dispatch all filters and callbacks

@param  string $method
@param  string $path

@return mixed

@throws Exception
@throws MethodNotAllowedException
@throws NotFoundException
Get matching route and dispatch all filters and callbacks