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
04:00 queued 02:11
created

LoaderPluginManager   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 3
dl 0
loc 38
rs 10
c 0
b 0
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\Loader;
3
4
use HtImgModule\Factory\Imagine\Loader\FileSystemLoaderFactory;
5
use HtImgModule\Factory\Imagine\Loader\SimpleFileSystemLoaderFactory;
6
use Zend\ServiceManager\AbstractPluginManager;
7
use HtImgModule\Exception;
8
use Zend\ServiceManager\Exception\InvalidServiceException;
9
10
class LoaderPluginManager extends AbstractPluginManager
11
{
12
    protected $instanceOf = LoaderInterface::class;
13
14
    protected $aliases = [
15
        'FileSystem' => 'filesystem',
16
        'Simple' => 'simple',
17
    ];
18
19
    protected $factories = [
20
        'filesystem' => FileSystemLoaderFactory::class,
21
        'simple'     => SimpleFileSystemLoaderFactory::class,
22
    ];
23
24
    protected $shared = [
25
        'simple' => false
26
    ];
27
28
    public function validate($instance)
29
    {
30
        if (! $instance instanceof $this->instanceOf) {
31
            throw new InvalidServiceException(sprintf(
32
                'Invalid plugin "%s" created; not an instance of %s',
33
                get_class($instance),
34
                $this->instanceOf
35
            ));
36
        }
37
    }
38
39
    public function validatePlugin($instance)
40
    {
41
        try {
42
            $this->validate($instance);
43
        } catch (InvalidServiceException $e) {
44
            throw new Exception\InvalidArgumentException($e->getMessage(), $e->getCode(), $e);
45
        }
46
    }
47
}
48