2023-04-15 23:29:27 +08:00
|
|
|
<?php
|
2023-04-16 01:24:30 +08:00
|
|
|
declare(strict_types=1);
|
2023-04-15 23:29:27 +08:00
|
|
|
|
2023-04-15 23:31:16 +08:00
|
|
|
namespace Kiri\Router\Base;
|
2023-04-15 23:29:27 +08:00
|
|
|
|
2023-04-16 01:24:30 +08:00
|
|
|
|
|
|
|
|
use Psr\Http\Message\ResponseInterface;
|
2023-04-15 23:29:27 +08:00
|
|
|
|
|
|
|
|
class NotFoundController extends Controller
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
2023-09-15 09:13:59 +08:00
|
|
|
/**
|
|
|
|
|
* @return ResponseInterface
|
|
|
|
|
*/
|
|
|
|
|
public function fail(): ResponseInterface
|
|
|
|
|
{
|
|
|
|
|
if ($this->request->getMethod() == 'OPTIONS') {
|
2025-12-30 21:50:02 +08:00
|
|
|
return $this->response->json([], 200);
|
2023-09-15 15:54:52 +08:00
|
|
|
} else {
|
2023-11-17 09:43:39 +08:00
|
|
|
return $this->response->withStatus(404, "not found page.");
|
2023-09-15 09:13:59 +08:00
|
|
|
}
|
|
|
|
|
}
|
2023-04-15 23:29:27 +08:00
|
|
|
|
|
|
|
|
}
|