Completed
Push — master ( 66d197...72430f )
by Jonathan
03:30
created

BaseManipulator   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 37
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
run() 0 1 ?
A setParams() 0 6 1
A __get() 0 6 2
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 135
    public function setParams(array $params)
20
    {
21 135
        $this->params = $params;
22
23 135
        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 144
    public function __get($name)
32
    {
33 144
        if (array_key_exists($name, $this->params)) {
34 132
            return $this->params[$name];
35
        }
36 48
    }
37
38
    /**
39
     * Perform the image manipulation.
40
     * @return Image The manipulated image.
41
     */
42
    abstract public function run(Image $image);
43
}
44