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 (#38)
by Andreas
05:29 queued 02:57
created

LeagueContainerAdapter   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 85.71%

Importance

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

3 Methods

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