mirror of
http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore.git
synced 2026-01-15 07:15:06 +08:00
33 lines
832 B
PHP
33 lines
832 B
PHP
<?php
|
|
/**
|
|
* ClassicStyleMiddleware.php@HDK-Core
|
|
*
|
|
* @author 李东云 <Dongyun.Li@LuxCreo.Ai>
|
|
* Powered by PhpStorm
|
|
* Created on 2023/3/10
|
|
*/
|
|
|
|
namespace Singularity\HDK\Core\Middleware;
|
|
|
|
use Psr\Http\Message\ResponseInterface;
|
|
use Psr\Http\Message\ServerRequestInterface;
|
|
use Psr\Http\Server\MiddlewareInterface;
|
|
use Psr\Http\Server\RequestHandlerInterface;
|
|
use Singularity\HDK\Core\Service\ApiStyleService;
|
|
|
|
class RestStyleMiddleware implements MiddlewareInterface
|
|
{
|
|
public function __construct(protected ApiStyleService $apiStyleService)
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
|
|
{
|
|
$this->apiStyleService->set(ApiStyleService::RESTFUL);
|
|
return $handler->handle($request);
|
|
}
|
|
}
|