Conditions | 7 |
Paths | 8 |
Total Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 7.0222 |
Changes | 0 |
1 | <?php |
||
20 | 3 | public function validate($value, $valueIdentifier = null) |
|
21 | { |
||
22 | 3 | $this->value = $value; |
|
23 | 3 | if (! is_array($value) || ! isset($value['tmp_name'])) { |
|
24 | $this->success = false; |
||
25 | 3 | } elseif (! file_exists($value['tmp_name'])) { |
|
26 | 2 | $this->success = $value['error'] === UPLOAD_ERR_NO_FILE; |
|
27 | 2 | } else { |
|
28 | 1 | $imageInfo = getimagesize($value['tmp_name']); |
|
29 | 1 | $height = isset($imageInfo[1]) ? $imageInfo[1] : 0; |
|
30 | 1 | $this->success = $height && |
|
31 | 1 | $height <= $this->options[self::OPTION_MAX] && |
|
32 | 1 | $height >= $this->options[self::OPTION_MIN]; |
|
33 | } |
||
34 | |||
35 | 3 | return $this->success; |
|
36 | } |
||
37 | } |
||
38 |