-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPsr7Middleware.php
47 lines (43 loc) · 1.2 KB
/
Psr7Middleware.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php declare(strict_types=1);
/**
* Part of Windwalker project.
*
* @copyright Copyright (C) 2019 LYRASOFT.
* @license GNU General Public License version 2 or later.
*/
namespace Windwalker\Middleware;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
/**
* The Psr7Middleware class.
*
* @since 3.0
*/
class Psr7Middleware extends CallbackMiddleware implements Psr7InvokableInterface
{
/**
* Middleware logic to be invoked.
*
* @param Request $request The request.
* @param Response $response The response.
* @param callable|MiddlewareInterface $next The next middleware.
*
* @return Response
*/
public function __invoke(Request $request, Response $response, $next = null)
{
return call_user_func($this->handler, $request, $response, $this->next);
}
/**
* Call next middleware.
*
* @param Request $request
* @param Response $response
*
* @return Response
*/
public function execute($request = null, $response = null)
{
return call_user_func($this, $request, $response);
}
}