| Conditions | 4 |
| Paths | 3 |
| Total Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | 7 | ]; |
|
| 24 | |||
| 25 | 7 | public function validate($value, string $valueIdentifier = null) |
|
| 26 | 5 | { |
|
| 27 | $this->value = $value; |
||
| 28 | 2 | $ratio = RuleHelper::normalizeImageRatio($this->options[self::OPTION_RATIO]); |
|
| 29 | 1 | if (! is_array($value) || ! isset($value['tmp_name'])) { |
|
| 30 | $this->success = false; |
||
| 31 | 1 | } elseif (! file_exists($value['tmp_name'])) { |
|
| 32 | $this->success = $value['error'] === UPLOAD_ERR_NO_FILE; |
||
| 33 | } elseif ($ratio == 0) { |
||
| 34 | 1 | $this->success = true; |
|
| 35 | } else { |
||
| 36 | $imageInfo = getimagesize($value['tmp_name']); |
||
| 50 |