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.

LoaderPluginManager   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
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 38
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\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 2
    public function validate($instance)
29
    {
30 2
        if (! $instance instanceof $this->instanceOf) {
31 1
            throw new InvalidServiceException(sprintf(
32 1
                'Invalid plugin "%s" created; not an instance of %s',
33 1
                get_class($instance),
34 1
                $this->instanceOf
35
            ));
36
        }
37 1
    }
38
39 2
    public function validatePlugin($instance)
40
    {
41
        try {
42 2
            $this->validate($instance);
43 1
        } catch (InvalidServiceException $e) {
44 1
            throw new Exception\InvalidArgumentException($e->getMessage(), $e->getCode(), $e);
45
        }
46 1
    }
47
}
48