returns list of applicable post interceptors for this request

@param   \stubbles\webapp\routing\CalledUri  $calledUri
@param   \stubbles\webapp\routing\Route      $route
@return  array
352865
private function getPostInterceptors(CalledUri $calledUri, Route $route = null): array
    {
        $global = $this->getApplicable($calledUri, $this->postInterceptors);
        if (null === $route) {
            return $global;
        }

        return array_merge($route->postInterceptors(), $global);
    }
1025516
private function getCallable($method, $route)
	{
		if (!array_key_exists($method, $this->routes)) {
			throw new ServerResponseException(new ServerResponse(404));
		}

		foreach ($this->routes[$method] as $entry) {
			if (preg_match($entry->pattern, $route, $matches) > 0) {
				array_shift($matches);
				return [$entry->callable, $matches];
			}
		}

		throw new ServerResponseException(new ServerResponse(404));
	}
341598
public function dispatch(Route $route, $controller, $method)
    {
        $parameters = $this->resolveClassMethodDependencies(
            $route->parametersWithoutNulls(), $controller, $method
        );

        if (method_exists($controller, 'callAction')) {
            return $controller->callAction($method, $parameters);
        }

        return call_user_func_array(array($controller, $method), $parameters);
    }
763018
protected function filtering(
        RouteInterface $route,
        RequestInterface $request
    ) {
        foreach ($route->getFilters() as $field => $filter) {
            list($grpName, $keyName) = explode('.', $field, 2);
            switch ($grpName) {
                case 'session':
                    $against = isset($_SESSION[$keyName]) ?
                        $_SESSION[$keyName] : '';
                    break;
                case 'cookie':
                    $against = isset($_COOKIE[$keyName]) ?
                        $_COOKIE[$keyName] : '';
                    break;
                case 'request':
                    $against = $request->getRequestInfo($keyName);
                    break;
                default:
                    $against = $request->getServerInfo($keyName);
                    break;
            }

            if (is_callable($filter)) {
                return $filter((string) $against);
            } elseif (!preg_match('~'.$filter.'~x', (string) $against)) {
                return false;
            }
        }
        return true;
    }
459118
public function dispatch(string $httpMethod, string $uri) : array
    {
        $urlPath = rawurldecode(parse_url($uri, PHP_URL_PATH));
        $routeInfo = $this->routeDispatcher->dispatch($httpMethod, $urlPath);
        return $routeInfo;
    }
841530
private function signatureParameters(Route $route)
    {
        return collect($route->signatureParameters())
            ->reject(function (ReflectionParameter $parameter) use ($route) {
                return !array_key_exists($parameter->name, $route->parameters());
            })
            ->reject(function (ReflectionParameter $parameter) {
                return !$parameter->getClass();
            })->toArray();
    }
1144264
private function handleMatchingRoute(CalledUri $calledUri, Route $route): UriResource
    {
        if ($route->requiresAuth()) {
            return new ProtectedResource(
                $route->authConstraint(),
                $this->resolveResource($calledUri, $route),
                $this->injector
            );
        }

        return $this->resolveResource($calledUri, $route);
    }
1117212
public function gatherRouteMiddleware(Route $route)
    {
        $middleware = array_map(function ($name)
        {
            return $this->resolveMiddleware($name);

        }, $route->gatherMiddleware());

        return Arr::flatten($middleware);
    }
282670
protected function callController($callable, Request $request)
    {
        list($class, $action) = explode('@', $callable[0], 2);

        // Make sure any route parts are available as query parameters from the request.
        $request->query->add($callable[1]);

        $controller = $this->factory->make($class);
        $controller->setRequest($request);

        return $controller->call($action);
    }
1165717
public function callbackFunction($route = null, $parameters = [])
    {
        if ($route === null || ! is_string($route)) {
            // Gets URI from current request
            $uri = $this->request->getUri();
        } else {
            // Generates URI from '_route'
            $uri = $this->router->generate(
                $route,
                $parameters,
                Router::ABSOLUTE_URL
            );
        }

        $result = parse_url($uri);

        // When uri contains query string
        if (isset($result['query'])) {

            parse_str($result['query'], $query);

            // Remove callback from query
            $query = array_diff_key($query, ['callback' => null]);
        } else {
            // Return unchanged uri
            return $uri;
        }

        return $result['scheme'].'://'.
               (isset($result['user']) ? $result['user'] : '').
               (isset($result['pass']) ? ':'.$result['pass'].'@' : '').
               $result['host'].
               (isset($result['port']) ? ':'.$result['port'] : '').
               (isset($result['path']) ? $result['path'] : '').
               ($query != [] ? '?'.http_build_query($query) : '').
               (isset($result['fragment']) ? '#'.$result['fragment'] : '');
    }
1322686
function collect() {
        $dispatcher = $this->di['dispatcher'];
		$router = $this->di['router'];
		$route = $router->getMatchedRoute();
		if ( !$route) {
			return array();
		}

		$uri   = $route->getPattern();
		$paths = $route->getPaths();
		$result['uri']    = $uri ?: '-';
		$result['paths']  = $this->formatVar( $paths);
		if ( $params = $router->getParams()) {
			$result['params'] = $this->formatVar($params);
		}
		$result['HttpMethods'] = $route->getHttpMethods();
		$result['RouteName'] = $route->getName();
		$result['hostname'] = $route->getHostname();
		if ( $this->di->has('app') && ($app=$this->di['app']) instanceof  Micro ) {
			if ( ($handler=$app->getActiveHandler()) instanceof \Closure  ||  is_string($handler) ) {
				$reflector = new \ReflectionFunction($handler);
			}elseif(is_array($handler)){
				$reflector = new \ReflectionMethod($handler[0], $handler[1]);
			}
		}else{
			$result['Moudle']=$router->getModuleName();
			$result['Controller'] = $dispatcher->getActiveController() != null ? get_class( $controller_instance = $dispatcher->getActiveController()) : $controller_instance ="";
			$result['Action']     = $dispatcher->getActiveMethod();
			$reflector = new \ReflectionMethod($controller_instance, $result['Action']);
		}

		if (isset($reflector)) {
			$start = $reflector->getStartLine()-1;
			$stop  = $reflector->getEndLine();
			$filename = substr($reflector->getFileName(),mb_strlen(realpath(dirname($_SERVER['DOCUMENT_ROOT']))));
			$code = array_slice( file($reflector->getFileName()),$start, $stop-$start );
			$result['file'] = $filename . ':' . $reflector->getStartLine() . '-' . $reflector->getEndLine() . "  [CODE]: \n". implode("",$code);
		}

		return array_filter($result);
	}
382775
protected function getMethodPatterns($uri, $method)
    {
        return $this->router->findPatternFilters(Request::create($uri, $method));
    }
982124
protected function getRouteInformation(Route $route)
    {
        list($controller, $action) = explode("@", $route->getActionName());

        return [
            'host' => $route->domain(),
            'method' => implode('|', $route->methods()),
            'uri' => $route->uri(),
            'name' => $route->getName(),
            'controller' => $controller,
            'action' => $action,
            'resource' => $route->getActionName(),
            'middleware' => Collection::make($this->getMiddleware($route))
        ];
    }
1319242
public function resolveArguments(Callable $callable, Request $request, Array $route_info)
    {
        $arguments = array();

        // Examine the controller method with reflection and
        // build arguments
        $ref = new \ReflectionMethod($callable[0], $callable[1]);
        $req_attr = $request->query->all();

        foreach ($ref->getParameters() as $parameter) {
            if (array_key_exists($parameter->name, $req_attr)) {
                $arguments[] = $req_attr[$parameter->name];
            } elseif (array_key_exists($parameter->name, $route_info)) {
                $arguments[] = $route_info[$parameter->name];
            } elseif ($parameter->getClass() && $parameter->getClass()->isInstance($request)) {
                $arguments[] = $request;
            } elseif ($parameter->isDefaultValueAvailable()) {
                $arguments[] = $parameter->getDefaultValue();
            } else {
                throw new \RuntimeException(sprintf('Controller %s::%s requires a value for parameter %s.', get_class($callable[0]), $callable[1], $parameter->name));
            }
        }

        return($arguments);
    }
1176392
public function addRule(string $url, $callable, \Imi\Server\Route\Annotation\Route $annotation = null)
    {
        if(null === $annotation)
        {
            $annotation = new \Imi\Server\Route\Annotation\Route([
                'url' => $url,
            ]);
        }
        $this->rules[$url][$this->hashKey($annotation)] = [
            'annotation'=> $annotation,
            'callable'  => $callable,
        ];
    }
666308
protected function buildCallbackFromControllerRoute($route)
    {
        list($controller, $methodName) = $this->determineClassAndMethod($route);
        $app      = & $this;
        $callable = function () use ($app, $controller, $methodName) {
            // Get action arguments
            $args = func_get_args();
            // Try to fetch the instance from Slim's container, otherwise lazy-instantiate it
            $instance = $app->container->has($controller) ? $app->container->get($controller) : new $controller($app);

            return call_user_func_array(array($instance, $methodName), $args);
        };

        return $callable;
    }
1209228
public function post($route, $toController, $alias = null) 
	{
		$route = [
			'route' => $route,
			'toController' => $toController,
			'alias' => $alias,
			'isDynamic' => preg_match("/{([^{}?&]+)}/", $route),
		];
		$this->routes['POST'][] = $route;
	}