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.

PHPDIContainerAdapter   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 6
c 2
b 0
f 0
lcom 0
cbo 3
dl 0
loc 36
ccs 14
cts 14
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A get() 0 10 3
A has() 0 9 2
1
<?php
2
3
namespace Acclimate\Container\Adapter;
4
5
use Acclimate\Container\Exception\ContainerException as AcclimateContainerException;
6
use Acclimate\Container\Exception\NotFoundException as AcclimateNotFoundException;
7
use DI\Container as PhpDiContainerInterface;
8
use DI\NotFoundException as PhpDiNotFoundException;
9
use Interop\Container\ContainerInterface as AcclimateContainerInterface;
10
11
/**
12
 * An adapter from a PHP-DI Container to the standardized ContainerInterface
13
 */
14
class PHPDIContainerAdapter implements AcclimateContainerInterface
15
{
16
    /**
17
     * @var PhpDiContainerInterface A PHP-DI Container
18
     */
19
    private $container;
20
21
    /**
22
     * @param PhpDiContainerInterface $container A PHP-DI Container
23
     */
24 3
    public function __construct(PhpDiContainerInterface $container)
25
    {
26 3
        $this->container = $container;
27 3
    }
28
29 3
    public function get($id)
30
    {
31
        try {
32 3
            return $this->container->get($id);
33 2
        } catch (PhpDiNotFoundException $prev) {
34 1
            throw AcclimateNotFoundException::fromPrevious($id, $prev);
35 1
        } catch (\Exception $prev) {
36 1
            throw AcclimateContainerException::fromPrevious($id, $prev);
37
        }
38
    }
39
40 2
    public function has($id)
41
    {
42
        try {
43 2
            $this->container->get($id);
44 1
            return true;
45 1
        } catch (PhpDiNotFoundException $e) {
46 1
            return false;
47
        }
48
    }
49
}
50