Code Duplication    Length = 15-17 lines in 2 locations

src/Transformer/Crop.php 1 location

@@ 37-51 (lines=15) @@
34
    /**
35
     * {@inheritdoc}
36
     */
37
    public function apply($source, $options)
38
    {
39
        $options = $this->parseOptions($options);
40
41
        $image = $this->imageManager->make($source);
42
43
        $image->crop(
44
            $options['width'],
45
            $options['height'],
46
            $options['x'],
47
            $options['y']
48
        );
49
50
        return $image->encode($image->mime())->getEncoded();
51
    }
52
53
    /**
54
     * {@inheritdoc}

src/Transformer/Fit.php 1 location

@@ 51-67 (lines=17) @@
48
        $this->imageManager = $imageManager;
49
    }
50
51
    public function apply($source, $options)
52
    {
53
        $options = $this->parseOptions($options);
54
55
        $image = $this->imageManager->make($source);
56
57
        $image->fit(
58
            $options['width'],
59
            $options['height'],
60
            function ($constraint) {
61
                $constraint->upsize();
62
            },
63
            $options['position']
64
        );
65
66
        return $image->encode($image->mime())->getEncoded();
67
    }
68
69
    /**
70
     * {@inheritdoc}