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.

ResolverManager   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 58.33%

Importance

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

2 Methods

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