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.

GuzzleContainerAdapter   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 5
c 3
b 0
f 0
lcom 0
cbo 3
dl 0
loc 31
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A get() 0 10 3
A has() 0 4 1
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 Guzzle\Service\Builder\ServiceBuilderInterface as GuzzleContainerInterface;
8
use Guzzle\Service\Exception\ServiceNotFoundException as GuzzleNotFoundException;
9
use Interop\Container\ContainerInterface as AcclimateContainerInterface;
10
11
/**
12
 * @deprecated in v1.1
13
 * An adapter from a Guzzle ServiceBuilder to the standardized ContainerInterface
14
 */
15
class GuzzleContainerAdapter implements AcclimateContainerInterface
16
{
17
    /**
18
     * @var GuzzleContainerInterface A Guzzle ServiceBuilder
19
     */
20
    private $container;
21
22
    /**
23
     * @param GuzzleContainerInterface $container A Guzzle ServiceBuilder
24
     */
25
    public function __construct(GuzzleContainerInterface $container)
26
    {
27
        $this->container = $container;
28
    }
29
30
    public function get($id)
31
    {
32
        try {
33
            return $this->container->get($id);
34
        } catch (GuzzleNotFoundException $prev) {
35
            throw AcclimateNotFoundException::fromPrevious($id, $prev);
36
        } catch (\Exception $prev) {
37
            throw AcclimateContainerException::fromPrevious($id, $prev);
38
        }
39
    }
40
41
    public function has($id)
42
    {
43
        return isset($this->container[$id]);
44
    }
45
}
46