@param string $route
@param array  $parameters
@param string $message
@param string $type
@param int    $statusCode

@return static
194400
public static function create($route, array $parameters, $message, $type = self::DEFAULT_FLASH_KEY, $statusCode = self::DEFAULT_STATUS_CODE)
    {
        return new static($route, $parameters, array($type => array($message)), $statusCode);
    }
422024
public function invoke($route) {
        if ($route instanceof IRoute) {
            return $this->invokeRoute($route);
        }

        return new HttpResponse(HttpStatusCode::NOT_FOUND);
    }
895796
public function setRoute($route, array $params = array())
    {
        $this->route = $route;
        $this->routeParams = $params;

        return $this;
    }
789298
public function setMessage($message, $type = 'info', $parameters = [])
    {
        $this->getSession()->getFlashBag()->add($type, $this->translate($message, $parameters));
    }
1111227
public function redirect($url, $parameters = [], $status = 302)
    {
        if (substr($url, 0, 1) == '@') {
            $route = substr($url, 1);
            $url = $this->generateUrl($route, $parameters);
        }
        return new RedirectResponse($url, $status);
    }
52363
public function path($route, $page, array $parameters = [])
    {
        $fieldName = 'page';

        if (isset($parameters['_page'])) {
            $fieldName = $parameters['_page'];
            unset($parameters['_page']);
        }

        $parameters[$fieldName] = $page;

        return $this->router->generate($route, $parameters);
    }
597577
public static function create($route, $handler)
    {

        $methods = [Method::GET, Method::POST];
        if (preg_match('/^(?:(?<method>get|post|all)\s+)?/', $route, $matches)) {

            $method = strtoupper(isset($matches[1]) ? $matches[1] : 'all');

            if ($method !== 'ALL')
                $methods = [constant(Method::class."::$method")];

            $route = substr($route, strlen($matches[0]));
        }

        return new static($methods, $route, $handler);
    }
617208
public static function add($route, $parameters)
    {
        self::$route = $route;
        array_shift($parameters);
        self::$parameters = $parameters;
    }
1289552
public function success(int $statusCode, string $message, $data = null): JsonResponse
    {

        $this->setStatusCode($statusCode);

        $this->setMessage($message);

        $this->setData($data);


        $content['message'] = $this->getMessage();


        if (null !== $this->getCode()) {
            $content['code'] = $this->getCode();
        }


        $content['status_code'] = $this->getStatusCode();


        if (null !== $this->getData() && $this->getErrors() !== $this->getData()) {
            $content['data'] = $this->getData();
        }

        if (null !== $this->getErrors()) {
            $content['errors'] = $this->getErrors();
        }

        $content += $this->Hypermedia;

        return new JsonResponse($content, $this->getHttpStatusCode() ?: $this->getStatusCode());
    }
487651
public function &call($type, $method, $parameters = array())
	{
		$class = $this->get_class($type);

		if (in_array($class, $this->legacy))
		{
			switch ($type)
			{
				case 'Cache':
					// For backwards compatibility with old non-static
					// Cache::create() methods
					if ($method === 'get_handler')
					{
						$result = @call_user_func_array(array($class, 'create'), $parameters);
						return $result;
					}
					break;
			}
		}

		$result = call_user_func_array(array($class, $method), $parameters);
		return $result;
	}
1323918
public static function fromRoute(Route $route, array $params = []): self
    {
        $result = new self();
        $result->success = true;
        $result->route = $route;
        $result->matchedParams = $params;

        return $result;
    }
84771
public function route($text, $route, $parameters = [], $target = '')
    {
        $href = route($route, $parameters);
        $href .= !empty($target) ? '#'.$target : '';
        return $this->addElement('a')->text($text)
            ->href($href);
    }
295036
public static function register($name, $path, $controller, $parameters, $options=array()) {
		static::$routes[$name] = new static($name, $path, $controller, $parameters, $options);
	}
1207211
public function redirectRoute($name, $params = [], $statusCode = 302) {
		$this->redirect($this->urlGenerator->generate($name, $params), $statusCode);
		return $this;
	}
1112672
public function remove($route, $type = 'any')
    {
        if (isset($this->routes[$type][$route])) {
            unset($this->routes[$type][$route]);
        }
        return $this;
    }
305127
protected function setFlash($type,$message,$parameters = array(),$domain = 'flashes')
    {
        return $this->container->get('session')->getBag('flashes')->add($type,$message);
    }
851337
public function setHeaderResponse($statusCode, $message = '')
    {
        $this->statusCode = $statusCode;
        $this->message = $message;
        if ($message == '') {
            $this->message = self::$defaultMessages[$statusCode];
        }

        if (empty($this->message)) {
            throw new RestException('Invalid http response status code: ' . $statusCode);
        }

        return $this;
    }