1 | <?php |
||
12 | class MultiPartTransformer implements ResourceTransformerInterface |
||
13 | { |
||
14 | /** |
||
15 | * @var ReaderInterface |
||
16 | */ |
||
17 | protected $reader; |
||
18 | |||
19 | /** |
||
20 | * @var WriterInterface |
||
21 | */ |
||
22 | protected $writer; |
||
23 | |||
24 | /** |
||
25 | * @var int |
||
26 | */ |
||
27 | protected $size; |
||
28 | |||
29 | /** |
||
30 | * @var int|null |
||
31 | */ |
||
32 | protected $maxParts; |
||
33 | |||
34 | /** |
||
35 | * @param ReaderInterface $reader |
||
36 | * @param WriterInterface $writer |
||
37 | * @param int $size |
||
38 | * @param int $maxParts |
||
39 | */ |
||
40 | public function __construct(ReaderInterface $reader, WriterInterface $writer, $size = 1000, $maxParts = null) |
||
47 | |||
48 | /** |
||
49 | * @inheritdoc |
||
50 | */ |
||
51 | public function transform(ResourceInterface $resource, ResourceCollection $collection) |
||
75 | |||
76 | /** |
||
77 | * @inheritdoc |
||
78 | */ |
||
79 | public function needsTransforming(ResourceInterface $resource) |
||
83 | |||
84 | /** |
||
85 | * @param ResourceInterface $resource |
||
86 | * |
||
87 | * @return int |
||
88 | */ |
||
89 | protected function isPartFile(ResourceInterface $resource) |
||
93 | |||
94 | /** |
||
95 | * @param ResourceInterface $resource |
||
96 | * |
||
97 | * @return array |
||
98 | */ |
||
99 | protected function getPartFiles(ResourceInterface $resource) |
||
118 | |||
119 | /** |
||
120 | * @param ResourceInterface $resource |
||
121 | * |
||
122 | * @return array |
||
123 | */ |
||
124 | protected function breakup(ResourceInterface $resource) |
||
156 | |||
157 | /** |
||
158 | * @param string $file |
||
159 | */ |
||
160 | protected function startPart($file) |
||
166 | |||
167 | /** |
||
168 | */ |
||
169 | protected function endPart() |
||
173 | } |
||
174 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)
or! empty(...)
instead.