1 | <?php |
||
10 | class DataStream |
||
11 | { |
||
12 | /** |
||
13 | * @param mixed $input |
||
14 | * |
||
15 | * @throws StreamException |
||
16 | * |
||
17 | * @return resource |
||
18 | */ |
||
19 | public static function get($input) |
||
31 | |||
32 | /** |
||
33 | * @param resource $stream |
||
34 | * |
||
35 | * @return bool|null |
||
36 | */ |
||
37 | public static function close($stream): ?bool |
||
45 | |||
46 | /** |
||
47 | * Handler for resource input type |
||
48 | * |
||
49 | * @param mixed $input |
||
50 | * |
||
51 | * @throws StreamException |
||
52 | * |
||
53 | * @return resource |
||
54 | */ |
||
55 | protected static function resource($input) |
||
63 | |||
64 | /** |
||
65 | * Handler for string input type |
||
66 | * |
||
67 | * @param string $input |
||
68 | * |
||
69 | * @throws StreamException |
||
70 | * |
||
71 | * @return resource |
||
72 | */ |
||
73 | protected static function string(string $input) |
||
87 | |||
88 | /** |
||
89 | * Handler for object input type |
||
90 | * |
||
91 | * @param MessageInterface|StreamInterface $object |
||
92 | * |
||
93 | * @throws StreamException |
||
94 | * |
||
95 | * @return resource |
||
96 | */ |
||
97 | protected static function object($object) |
||
119 | |||
120 | /** |
||
121 | * Stream content from the given stream wrapper |
||
122 | * |
||
123 | * @param StreamInterface $stream |
||
124 | * |
||
125 | * @throws StreamException |
||
126 | * |
||
127 | * @return resource |
||
128 | */ |
||
129 | protected static function streamWrapper(StreamInterface $stream) |
||
148 | } |
||
149 |