Completed
Push — master ( 72430f...dafba8 )
by Jonathan
04:56
created

BaseManipulator::__get()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2.1481

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 6
ccs 4
cts 6
cp 0.6667
rs 10
cc 2
nc 2
nop 1
crap 2.1481
1
<?php
2
3
namespace League\Glide\Manipulators;
4
5
use Intervention\Image\Image;
6
7
abstract class BaseManipulator implements ManipulatorInterface
8
{
9
    /**
10
     * The manipulation params.
11
     * @var array
12
     */
13
    public $params = [];
14
15
    /**
16
     * Set the manipulation params.
17
     * @param array $params The manipulation params.
18
     */
19 90
    public function setParams(array $params)
20
    {
21 90
        $this->params = $params;
22
23 90
        return $this;
24
    }
25
26
    /**
27
     * Get a specific manipulation param.
28
     * @param  string $name The manipulation name.
29
     * @return string The manipulation value.
30
     */
31 96
    public function __get($name)
32
    {
33 96
        if (array_key_exists($name, $this->params)) {
34 88
            return $this->params[$name];
35
        }
36 32
    }
37
38
    /**
39
     * Perform the image manipulation.
40
     * @return Image The manipulated image.
41
     */
42
    abstract public function run(Image $image);
43
}
44