Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
20 / 20 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
Request | |
100.00% |
20 / 20 |
|
100.00% |
1 / 1 |
5 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
20 / 20 |
|
100.00% |
1 / 1 |
5 |
1 | <?php |
2 | |
3 | namespace BO\Zmsclient\Psr7; |
4 | |
5 | use Slim\Psr7\Interfaces\HeadersInterface; |
6 | use Slim\Psr7\Headers; |
7 | use Psr\Http\Message\UriInterface; |
8 | use Psr\Http\Message\StreamInterface; |
9 | use BO\Slim\Request as SlimRequest; |
10 | |
11 | /** |
12 | * Layer to change PSR7 implementation if necessary |
13 | * @SuppressWarnings(Superglobals) |
14 | */ |
15 | class Request extends SlimRequest implements \Psr\Http\Message\ServerRequestInterface |
16 | { |
17 | public function __construct($method = null, $uri = null, $body = 'php://memory', $headers = array()) |
18 | { |
19 | $cookies = []; |
20 | $serverParams = $_SERVER; |
21 | $uploadedFiles = []; |
22 | if (!$uri instanceof UriInterface) { |
23 | $uri = new Uri($uri); |
24 | } |
25 | if (!$headers instanceof HeadersInterface) { |
26 | $headers = new Headers($headers); |
27 | } |
28 | if (!$body instanceof StreamInterface) { |
29 | if (!is_resource($body)) { |
30 | $body = fopen($body, 'w+b'); |
31 | } |
32 | $body = new Stream($body); |
33 | } |
34 | parent::__construct( |
35 | $method, |
36 | $uri, |
37 | $headers, |
38 | $cookies, |
39 | $serverParams, |
40 | $body, |
41 | $uploadedFiles |
42 | ); |
43 | } |
44 | } |