Skip to content

Commit b49e1f9

Browse files
authored
Merge pull request #71 from mnapoli/update-from-psr
Update interfaces to the latest version of PSR-15
2 parents 0ee0614 + 393734d commit b49e1f9

File tree

4 files changed

+32
-23
lines changed

4 files changed

+32
-23
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
},
2424
"autoload": {
2525
"psr-4": {
26-
"Interop\\Http\\ServerMiddleware\\": "src/"
26+
"Interop\\Http\\Server\\": "src/"
2727
}
2828
},
2929
"extra": {

src/DelegateInterface.php

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/MiddlewareInterface.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
11
<?php
22

3-
namespace Interop\Http\ServerMiddleware;
3+
namespace Interop\Http\Server;
44

55
use Psr\Http\Message\ResponseInterface;
66
use Psr\Http\Message\ServerRequestInterface;
77

8+
/**
9+
* An HTTP middleware component participates in processing an HTTP message,
10+
* either by acting on the request or the response. This interface defines the
11+
* methods required to use the middleware.
12+
*/
813
interface MiddlewareInterface
914
{
1015
/**
1116
* Process an incoming server request and return a response, optionally delegating
12-
* to the next middleware component to create the response.
17+
* response creation to a handler.
1318
*
1419
* @param ServerRequestInterface $request
15-
* @param DelegateInterface $delegate
20+
* @param RequestHandlerInterface $handler
1621
*
1722
* @return ResponseInterface
1823
*/
19-
public function process(ServerRequestInterface $request, DelegateInterface $delegate);
24+
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler);
2025
}

src/RequestHandlerInterface.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
namespace Interop\Http\Server;
4+
5+
use Psr\Http\Message\ResponseInterface;
6+
use Psr\Http\Message\ServerRequestInterface;
7+
8+
/**
9+
* An HTTP request handler process a HTTP request and produces an HTTP response.
10+
* This interface defines the methods require to use the request handler.
11+
*/
12+
interface RequestHandlerInterface
13+
{
14+
/**
15+
* Handle the request and return a response.
16+
*
17+
* @param ServerRequestInterface $request
18+
*
19+
* @return ResponseInterface
20+
*/
21+
public function handle(ServerRequestInterface $request);
22+
}

0 commit comments

Comments
 (0)