/** * Replace key in URL or string. * When replacing in URL instance method can be 'replace' or 'setGet'. * * @param URL|string $url * @param string * @param string * @param string * @return type */ protected function replaceUrl($url, $key, $value, $method = 'replace') { if ($url instanceof URL) { return $url->copy()->{$method}($key, $value); } return str_replace($key, $value, $url); }
/** * Set headers for redirect. * * @param string|URL $url * @param int $code Header Code * @return self */ public function redirect($url, $code = 302) { if ($url instanceof URL) { $url->full(); } return $this->headerCode($code)->header('Location', (string) $url); }