1 | <?php |
||
17 | class StreamHandler |
||
18 | { |
||
19 | private $globs = []; |
||
20 | |||
21 | private $toPush = []; |
||
22 | |||
23 | private $temp = []; |
||
24 | |||
25 | /** |
||
26 | * Provides streams by the pattern passed |
||
27 | * |
||
28 | * @param string|array $accept |
||
29 | * @param string|array|null $exclude |
||
30 | * |
||
31 | * @return self |
||
32 | */ |
||
33 | public function src($accept, $exclude = null) : self |
||
55 | |||
56 | /** |
||
57 | * Handle each stream |
||
58 | * |
||
59 | * @param callable|PluginInterface $callback |
||
60 | * |
||
61 | * @return self |
||
62 | */ |
||
63 | public function forStream($callback) : self |
||
85 | |||
86 | /** |
||
87 | * Handle all streams |
||
88 | * |
||
89 | * @param callable|PluginInterface $callback |
||
90 | * |
||
91 | * @return self |
||
92 | */ |
||
93 | public function forStreams($callback) : self |
||
111 | |||
112 | private function getCallback($cb) : callable |
||
124 | |||
125 | /** |
||
126 | * Pushes a stream to be used on destination |
||
127 | * |
||
128 | * @param StreamInterface $stream |
||
129 | */ |
||
130 | public function push(StreamInterface $stream) |
||
134 | |||
135 | /** |
||
136 | * Creates a temporary stream |
||
137 | * It will be deleted in the end of task execution |
||
138 | * |
||
139 | * @param StreamInterface $stream |
||
140 | */ |
||
141 | public function temp(StreamInterface $stream) |
||
146 | |||
147 | /** |
||
148 | * Sends pushed streams to a directory (plugin) |
||
149 | * |
||
150 | * @param string $dest |
||
151 | * |
||
152 | * @return callable |
||
153 | */ |
||
154 | public function toDir(string $dest) : ToDirPlugin |
||
158 | |||
159 | /** |
||
160 | * Cleans up pushed streams and delete indicated temporary files |
||
161 | * |
||
162 | * @return self |
||
163 | */ |
||
164 | public function end() : self |
||
177 | |||
178 | private function recoursiveGlob($pattern, $flags = 0) : array |
||
214 | |||
215 | /** |
||
216 | * Ignore files provided by glob function |
||
217 | * |
||
218 | * @param array $files |
||
219 | * @param array|string $patterns |
||
220 | * |
||
221 | * @return array |
||
222 | */ |
||
223 | private function ignoreFiles(array $files, $patterns) |
||
249 | } |
This check looks at variables that have been passed in as parameters and are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.