Conditions | 2 |
Paths | 2 |
Total Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
18 | 2 | ]; |
|
19 | |||
20 | 2 | public function validate($value, string $valueIdentifier = null) |
|
21 | 2 | { |
|
22 | 2 | $this->value = $value; |
|
23 | 1 | if (! is_array($value) || ! isset($value['tmp_name'])) { |
|
24 | 1 | $this->success = false; |
|
25 | 1 | } elseif (! file_exists($value['tmp_name'])) { |
|
26 | 1 | $this->success = $value['error'] === UPLOAD_ERR_NO_FILE; |
|
27 | } else { |
||
28 | $fileSize = @filesize($value['tmp_name']); |
||
29 | 2 | $limit = RuleHelper::normalizeFileSize($this->options[self::OPTION_SIZE]); |
|
30 | $this->success = $fileSize && $fileSize <= $limit; |
||
31 | } |
||
36 |