| Conditions | 1 |
| Paths | 1 |
| Total Lines | 9 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 1 |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | 13 | protected function calculateSize(int $currentWidth, int $maxWidth, int $currentHeight, int $maxHeight): array |
|
| 21 | { |
||
| 22 | 13 | $newWidth = $currentWidth / $maxWidth; |
|
| 23 | 13 | $newHeight = $currentHeight / $maxHeight; |
|
| 24 | 13 | $ratio = max($newWidth, $newHeight); // due this it's necessary to pass all |
|
| 25 | 13 | $ratio = max($ratio, 1.0); |
|
| 26 | 13 | $newWidth = (int) ($currentWidth / $ratio); |
|
| 27 | 13 | $newHeight = (int) ($currentHeight / $ratio); |
|
| 28 | 13 | return ['width' => $newWidth, 'height' => $newHeight]; |
|
| 29 | } |
||
| 31 |