| Conditions | 7 |
| Paths | 6 |
| Total Lines | 23 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | public function validateMediaItem(): bool |
||
| 14 | { |
||
| 15 | if (! $media = $this->getTemporaryUploadMedia()) { |
||
| 16 | return true; |
||
| 17 | } |
||
| 18 | |||
| 19 | $size = getimagesize($media->getPath()); |
||
| 20 | $actualWidth = $size[0]; |
||
| 21 | $actualHeight = $size[1]; |
||
| 22 | |||
| 23 | if ($this->requiredWidth && $this->requiredHeight) { |
||
| 24 | return $actualWidth === $this->requiredWidth && $actualHeight === $this->requiredHeight; |
||
| 25 | } |
||
| 26 | |||
| 27 | if ($this->requiredWidth) { |
||
| 28 | return $actualWidth === $this->requiredWidth; |
||
| 29 | } |
||
| 30 | |||
| 31 | if ($this->requiredHeight) { |
||
| 32 | return $actualHeight === $this->requiredHeight; |
||
| 33 | } |
||
| 34 | |||
| 35 | return false; |
||
| 36 | } |
||
| 58 |