-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMiddlewareStackInterface.php
More file actions
65 lines (58 loc) · 1.76 KB
/
MiddlewareStackInterface.php
File metadata and controls
65 lines (58 loc) · 1.76 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
/*
* This file is part of the Active Collab Middleware Stack.
*
* (c) A51 doo <[email protected]>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace ActiveCollab\MiddlewareStack;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use Exception;
/**
* @package ActiveCollab\MiddlewareStack
*/
interface MiddlewareStackInterface
{
/**
* Process a request.
*
* This method traverses the application middleware stack and then returns the
* resultant Response object.
*
* @param ServerRequestInterface $request
* @param ResponseInterface $response
* @return ResponseInterface
* @throws Exception
*/
public function process(ServerRequestInterface $request, ResponseInterface $response);
/**
* Add middleware.
*
* This method prepends new middleware to the application middleware stack.
*
* $middleware can be any callable that accepts three arguments:
*
* 1. A Request object
* 2. A Response object
* 3. A "next" middleware callable
*
* @param callable $middleware
* @return $this
* @throws \RuntimeException If middleware is added while the stack is dequeuing
* @throws \UnexpectedValueException If the middleware doesn't return a Psr\Http\Message\ResponseInterface
*/
public function &addMiddleware(callable $middleware);
/**
* @param callable $handler
* @return $this
*/
public function &setExceptionHandler(callable $handler = null);
/**
* @param callable $handler
* @return $this
*/
public function &setPhpErrorHandler(callable $handler = null);
}