Conditions | 5 |
Paths | 9 |
Total Lines | 19 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
36 | 3 | public function load(array $options = []) |
|
37 | { |
||
38 | 3 | if (!isset($options['image'])) { |
|
39 | 1 | throw new Exception\InvalidArgumentException('Option "image" is required.'); |
|
40 | } |
||
41 | |||
42 | 2 | $x = isset($options['x']) ? $options['x'] : 0; |
|
43 | 2 | $y = isset($options['y']) ? $options['y'] : 0; |
|
44 | |||
45 | 2 | $path = $this->resolver->resolve($options['image']); |
|
46 | |||
47 | 2 | if (!$path) { |
|
48 | 1 | throw new Exception\RuntimeException(sprintf('Could not resolve %s', $options['image'])); |
|
49 | } |
||
50 | |||
51 | 1 | $image = $this->imagine->open($path); |
|
52 | |||
53 | 1 | return new PasteFilter($image, $x, $y); |
|
54 | } |
||
55 | } |
||
56 |