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.

Paste   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 5
dl 0
loc 47
rs 10
c 0
b 0
f 0
ccs 14
cts 14
cp 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
B load() 0 19 5
1
<?php
2
namespace HtImgModule\Imagine\Filter\Loader;
3
4
use Imagine\Image\ImagineInterface;
5
use HtImgModule\Imagine\Filter\Paste as PasteFilter;
6
use HtImgModule\Exception;
7
use Zend\View\Resolver\ResolverInterface;
8
9
class Paste implements LoaderInterface
10
{
11
    /**
12
     * @var ImagineInterface
13
     */
14
    protected $imagine;
15
16
    /**
17
     * @var ResolverInterface
18
     */
19
    protected $resolver;
20
21
    /**
22
     * Constructor
23
     *
24
     * @param ImagineInterface  $imagine
25
     * @param ResolverInterface $resolver
26
     */
27 6
    public function __construct(ImagineInterface $imagine, ResolverInterface $resolver)
28
    {
29 6
        $this->imagine = $imagine;
30 6
        $this->resolver = $resolver;
31 6
    }
32
33
    /**
34
     * {@inheritDoc}
35
     */
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