Conditions | 6 |
Paths | 8 |
Total Lines | 11 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
1 | <?php |
||
18 | public function isValid() |
||
|
|||
19 | { |
||
20 | if ($this->isNotRequiredAndEmpty()) { |
||
21 | return true; |
||
22 | } |
||
23 | |||
24 | $value = trim($this->getParams()[1]); |
||
25 | |||
26 | return (bool) $value || $value == '0' |
||
27 | || !empty($_FILES) && isset($_FILES[$this->getParams()[0]]) && $_FILES[$this->getParams()[0]]['name']; |
||
28 | } |
||
29 | |||
35 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: