Code Duplication    Length = 6-6 lines in 2 locations

src/Scaler/FileSizeScaler.php 1 location

@@ 41-46 (lines=6) @@
38
            $responsiveImage->addSource($scaledSrc, $newWidth);
39
40
            $publicScaledPath = "{$this->publicPath}/{$urlPath}/{$scaledName}";
41
            if (!$this->enableCache || !$this->fs->exists($publicScaledPath)) {
42
                $this->fs->dumpFile(
43
                    $publicScaledPath,
44
                    $imageObject->resize($newWidth, $newWidth * $ratio)->encode($extension)
45
                );
46
            }
47
48
            $fileSize = $fileSize * $this->stepModifier;
49
            $newWidth = floor(sqrt(($fileSize / $pixelPrice) / $ratio));

src/Scaler/WidthScaler.php 1 location

@@ 30-35 (lines=6) @@
27
            $responsiveImage->addSource($scaledSrc, $width);
28
29
            $publicScaledPath = "{$this->publicPath}/{$urlPath}/{$scaledName}";
30
            if (!$this->enableCache || !$this->fs->exists($publicScaledPath)) {
31
                $this->fs->dumpFile(
32
                    $publicScaledPath,
33
                    $imageObject->resize($width, $height)->encode($extension)
34
                );
35
            }
36
37
            $width = floor($width * $this->stepModifier);
38
            $height = floor($height * $this->stepModifier);