/** * Sets the location header including the HTTP status header for redirects * * @param string $target The target to use in location header * @param int $httpCode The HTTP code to use * @see \AppZap\PHPFramework\Mvc\HttpStatus */ public function redirect($target, $httpCode = HttpStatus::STATUS_307_TEMPORARY_REDIRECT) { if (php_sapi_name() !== 'cli') { HttpStatus::setStatus($httpCode, [HttpStatus::HEADER_FIELD_LOCATION => $target]); HttpStatus::sendHeaders(); } }
/** * @throws \Exception */ public function handleNotSupportedMethod() { HttpStatus::setStatus(HttpStatus::STATUS_405_METHOD_NOT_ALLOWED, [HttpStatus::HEADER_FIELD_ALLOW => join(', ', $this->getImplementedMethods())]); HttpStatus::sendHeaders(); throw new DispatchingInterruptedException('Request method not allowed', 1415268266); }