Total Complexity | 6 |
Total Lines | 32 |
Duplicated Lines | 0 % |
Coverage | 60% |
Changes | 0 |
1 | <?php |
||
7 | class Message implements MessageInterface |
||
8 | { |
||
9 | |||
10 | use MessageTrait; |
||
11 | |||
12 | /** |
||
13 | * @param StreamInterface|resource|string $stream |
||
14 | * @param string $mode |
||
15 | * @return \DevOp\Core\Http\Stream|StreamInterface |
||
16 | * @throws \InvalidArgumentException |
||
17 | */ |
||
18 | 2 | public function getStream($stream, $mode = 'r') |
|
19 | { |
||
20 | 2 | if ($stream instanceof StreamInterface) { |
|
21 | return $stream; |
||
22 | } |
||
23 | |||
24 | 2 | if (!is_string($stream) && !is_resource($stream)) { |
|
25 | throw new \InvalidArgumentException('Stream must be a string or resource.'); |
||
26 | } |
||
27 | |||
28 | 2 | return new Stream($stream, $mode); |
|
29 | } |
||
30 | |||
31 | /** |
||
32 | * @param array $headers |
||
33 | */ |
||
34 | 2 | public function setHeaders(array $headers = []) |
|
39 | } |
||
40 | 2 | } |
|
42 |