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 — update-dep ( 81e7ea )
by
unknown
06:38
created

FilterLoaderPluginManager::validate()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
ccs 7
cts 7
cp 1
cc 2
eloc 6
nc 2
nop 1
crap 2
1
<?php
2
namespace HtImgModule\Imagine\Filter\Loader;
3
4
use Zend\ServiceManager\AbstractPluginManager;
5
use HtImgModule\Exception;
6
use Zend\ServiceManager\Exception\InvalidServiceException;
7
use Zend\ServiceManager\Factory\InvokableFactory;
8
9
class FilterLoaderPluginManager extends AbstractPluginManager
10
{
11
    protected $instanceOf = LoaderInterface::class;
12
13
    protected $aliases  = [
14
        'Crop' => Crop::class,
15
        'crop' => Crop::class,
16
        'RelativeResize' => RelativeResize::class,
17
        'relativeResize' => RelativeResize::class,
18
        'relativeresize' => RelativeResize::class,
19
        'Resize' => Resize::class,
20
        'resize' => Resize::class,
21
        'Thumbnail' => Thumbnail::class,
22
        'thumbnail' => Thumbnail::class,
23
    ];
24
25
    protected $factories = [
26
        'chain' => 'HtImgModule\Imagine\Filter\Loader\Factory\ChainFactory',
27
        'paste' => 'HtImgModule\Imagine\Filter\Loader\Factory\PasteFactory',
28
        'watermark' => 'HtImgModule\Imagine\Filter\Loader\Factory\WatermarkFactory',
29
        'background' => 'HtImgModule\Imagine\Filter\Loader\Factory\BackgroundFactory',
30
        Crop::class => InvokableFactory::class,
31
        RelativeResize::class => InvokableFactory::class,
32
        Resize::class => InvokableFactory::class,
33
        Thumbnail::class => InvokableFactory::class,
34
    ];
35
36 2
    public function validate($instance)
37
    {
38 2
        if (!$instance instanceof $this->instanceOf) {
39 1
            throw new InvalidServiceException(sprintf(
40 1
                'Invalid plugin "%s" created; not an instance of %s',
41 1
                get_class($instance),
42 1
                $this->instanceOf
43
            ));
44
        }
45 1
    }
46
47 2
    public function validatePlugin($instance)
48
    {
49
        try {
50 2
            $this->validate($instance);
51 1
        } catch (InvalidServiceException $e) {
52 1
            throw new Exception\InvalidArgumentException($e->getMessage(), $e->getCode(), $e);
53
        }
54 1
    }
55
}
56