Total Complexity | 6 |
Total Lines | 35 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
12 | final class WritableStream implements IWritableStream |
||
13 | { |
||
14 | /** |
||
15 | * @var resource |
||
16 | */ |
||
17 | private $stream; |
||
18 | |||
19 | /** |
||
20 | * @throws InvalidArgument |
||
21 | */ |
||
22 | public function __construct(mixed $stream) |
||
23 | { |
||
24 | if (!is_resource($stream) || get_resource_type($stream) !== 'stream') { |
||
25 | throw new InvalidArgument( |
||
26 | sprintf( |
||
27 | 'Argument is expected to be a stream(resource), "%s" given.', |
||
28 | get_debug_type($stream) |
||
29 | ) |
||
30 | ); |
||
31 | } |
||
32 | |||
33 | $this->stream = $stream; |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * @codeCoverageIgnore |
||
38 | * |
||
39 | * @inheritDoc |
||
40 | */ |
||
41 | public function write(Traversable $data): void |
||
47 | } |
||
48 | } |
||
52 |