Conditions | 4 |
Paths | 6 |
Total Lines | 21 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
33 | public function scale(SplFileInfo $sourceFile, Image $imageObject) : array { |
||
34 | $imageWidth = $imageObject->getWidth(); |
||
35 | $imageHeight = $imageObject->getHeight(); |
||
36 | $ratio = $imageHeight / $imageWidth; |
||
37 | |||
38 | $sizes = []; |
||
39 | |||
40 | if ($this->includeSource) { |
||
41 | $sizes[$imageWidth] = $imageHeight; |
||
42 | } |
||
43 | |||
44 | foreach ($this->sizes as $width) { |
||
45 | if ($width > $imageWidth) { |
||
46 | continue; |
||
47 | } |
||
48 | |||
49 | $sizes[$width] = round($width * $ratio); |
||
50 | } |
||
51 | |||
52 | return $sizes; |
||
53 | } |
||
54 | } |
||
55 |