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 — master ( 037104...b3593d )
by
unknown
10s
created

ResolverManager::validatePlugin()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 8
ccs 0
cts 5
cp 0
rs 9.4285
c 1
b 0
f 0
cc 2
eloc 5
nc 2
nop 1
crap 6
1
<?php
2
namespace HtImgModule\Imagine\Resolver;
3
4
use HtImgModule\Imagine\Resolver\Factory\ImageMapResolverFactory;
5
use HtImgModule\Imagine\Resolver\Factory\ImagePathStackResolverFactory;
6
use Zend\ServiceManager\AbstractPluginManager;
7
use HtImgModule\Exception;
8
use Zend\ServiceManager\Exception\InvalidServiceException;
9
10
class ResolverManager extends AbstractPluginManager
11
{
12
    protected $instanceOf = ResolverInterface::class;
13
    /**
14
     * @var array
15
     */
16
    protected $aliases = [
17
        'image_path_stack' => 'imagepathstack',
18
        'imagePathStack' => 'imagepathstack',
19
        'ImagePathStack' => 'imagepathstack',
20
        'image_map' => 'imagemap',
21
        'imageMap' => 'imagemap',
22
        'ImageMap' => 'imagemap',
23
    ];
24
25
    protected $factories  = [
26
        'imagemap' => ImageMapResolverFactory::class,
27
        'imagepathstack' => ImagePathStackResolverFactory::class,
28
    ];
29
30 2
    public function validate($instance)
31
    {
32 2
        if (! $instance instanceof $this->instanceOf) {
33 1
            throw new InvalidServiceException(sprintf(
34 1
                'Invalid plugin "%s" created; not an instance of %s',
35 1
                get_class($instance),
36 1
                $this->instanceOf
37
            ));
38
        }
39 1
    }
40
41
    /**
42
     * Checks if $plugin is instance of ResolverInterface
43
     *
44
     * @param  mixed $instance
45
     * @return void
46
     * @throws Exception\InvalidArgumentException
47
     */
48
    public function validatePlugin($instance)
49
    {
50
        try {
51
            $this->validate($instance);
52
        } catch (InvalidServiceException $e) {
53
            throw new Exception\InvalidArgumentException($e->getMessage(), $e->getCode(), $e);
54
        }
55
    }
56
}
57