Conditions | 5 |
Paths | 3 |
Total Lines | 12 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
20 | public function __construct($stream = STDOUT) |
||
21 | { |
||
22 | if (!is_resource($stream) || get_resource_type($stream) !== 'stream') { |
||
23 | throw new \InvalidArgumentException('Expected a valid stream'); |
||
24 | } |
||
25 | |||
26 | $meta = stream_get_meta_data($stream); |
||
27 | if (strpos($meta['mode'], 'r') !== false && strpos($meta['mode'], '+') === false) { |
||
28 | throw new \InvalidArgumentException('Expected a writable stream'); |
||
29 | } |
||
30 | |||
31 | $this->stream = $stream; |
||
32 | } |
||
47 |