GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( f9e5d0...b497b7 )
by Freek
02:17
created

Image::getManipulationSequence()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Spatie\Image;
4
5
use Exception;
6
7
/** @mixin \Spatie\Image\Manipulations */
8
class Image
9
{
10
    /** @var string */
11
    protected $pathToImage;
12
13
    /** @var \Spatie\Image\Manipulations */
14
    protected $manipulations;
15
16
    /** @var */
17
    protected $imageDriver = 'gd';
18
19
    public static function load($pathToImage)
20
    {
21
        return new static($pathToImage);
22
    }
23
24
    public function __construct(string $pathToImage)
25
    {
26
        $this->pathToImage = $pathToImage;
27
28
        $this->manipulations = new Manipulations();
29
    }
30
31
    /**
32
     * @param string $imageDriver
33
     *
34
     * @return $this
35
     */
36
    public function useImageDriver(string $imageDriver)
37
    {
38
        $this->imageDriver = $imageDriver;
39
40
        return $this;
41
    }
42
43
    /**
44
     * @param callable|$manipulations
45
     * @return $this
46
     */
47
    public function manipulate($manipulations)
48
    {
49
        if (is_callable($manipulations)) {
50
            $manipulations($this->manipulations);
51
        }
52
53
        if ($manipulations instanceof Manipulations) {
54
            $this->manipulations->mergeManipulations($manipulations);
55
        }
56
57
        return $this;
58
    }
59
60
    public function __call($name, $arguments)
61
    {
62
        if (! method_exists($this->manipulations, $name)) {
63
            throw new Exception("Manipulation `{$name}` does not exist");
64
        }
65
66
        $this->manipulations->$name(...$arguments);
67
68
        return $this;
69
    }
70
71
    public function getManipulationSequence(): ManipulationSequence
72
    {
73
        return $this->manipulations->getManipulationSequence();
74
    }
75
76
    public function save($outputPath = '')
77
    {
78
        if ($outputPath == '') {
79
            $outputPath = $this->pathToImage;
80
        }
81
82
        GlideConversion::create($this->pathToImage)
83
            ->useImageDriver($this->imageDriver)
84
            ->performManipulations($this->manipulations)
85
            ->save($outputPath);
86
    }
87
}
88