/** * Gets a new request for chaining based on the provided arguments * @param string $controllerClass Full class name of the controller for the new request * @param string|null $action Action method in the controller * @param boolean|int|array $parameters provide an array as parameters for * the new request. If a boolean is provided, the parameters will be taken * from the request. Set the boolean to true and the first parameter will * be taken of the parameter array and added to the base path. You can also * provide the number of parameters to be taken of the parameter array and * added to the base path. * @param string $basePath the basePath for your new request. if none * specified, the base path will be taken from the current request * @return zibo\core\Request */ protected function forward($controllerClass, $action = null, $parameters = true, $basePath = null) { $baseUrl = $this->request->getBaseUrl(); if (!$basePath) { $basePath = $this->request->getBasePath(); } if (!is_array($parameters)) { $requestParameters = $this->request->getParameters(); if (is_bool($parameters) && $parameters) { $parameters = 1; } if (is_numeric($parameters) && $parameters > 0) { for ($i = 0; $i < $parameters; $i++) { $basePathSuffix = array_shift($requestParameters); $basePath .= Request::QUERY_SEPARATOR . $basePathSuffix; } } $parameters = $requestParameters; } return new Request($baseUrl, $basePath, $controllerClass, $action, $parameters, $this->request->getQueryParameters(), $this->request->getBodyParameters()); }