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
Pull Request — master (#34)
by
unknown
03:46 queued 01:58
created

FilterLoaderPluginManager   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 3
dl 0
loc 47
rs 10
c 0
b 0
f 0
ccs 12
cts 12
cp 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A validate() 0 10 2
A validatePlugin() 0 8 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