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.

ContainerLocator   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 2
dl 0
loc 24
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A get() 0 11 3
1
<?php declare(strict_types=1);
2
3
namespace ApiClients\Foundation\Middleware\Locator;
4
5
use ApiClients\Foundation\Middleware\MiddlewareInterface;
6
use Psr\Container\ContainerInterface;
7
8
final class ContainerLocator implements Locator
9
{
10
    /**
11
     * @var ContainerInterface
12
     */
13
    private $container;
14
15 3
    public function __construct(ContainerInterface $container)
16
    {
17 3
        $this->container = $container;
18 3
    }
19
20 3
    public function get(string $middleware): MiddlewareInterface
21
    {
22 3
        if ($this->container->has($middleware)) {
23 3
            $instance = $this->container->get($middleware);
24 3
            if ($instance instanceof MiddlewareInterface) {
25 1
                return $instance;
26
            }
27
        }
28
29 2
        throw new InvalidMiddlewareException();
30
    }
31
}
32