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.

FailoverOnMissContainer   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A get() 0 8 2
1
<?php
2
3
namespace Acclimate\Container\Decorator;
4
5
use Interop\Container\ContainerInterface;
6
use Interop\Container\Exception\NotFoundException;
7
8
/**
9
 * A container decorator that delegates to a designated failover container if the decorated container does not contain
10
 * the requested entry
11
 */
12
class FailoverOnMissContainer extends AbstractContainerDecorator
13
{
14
    /**
15
     * @var ContainerInterface
16
     */
17
    private $failoverContainer;
18
19
    /**
20
     * @param ContainerInterface $container         The container being decorated
21
     * @param ContainerInterface $failoverContainer The container to act as a failover
22
     */
23 1
    public function __construct(ContainerInterface $container, ContainerInterface $failoverContainer)
24
    {
25 1
        parent::__construct($container);
26 1
        $this->failoverContainer = $failoverContainer;
27 1
    }
28
29 1
    public function get($id)
30
    {
31
        try {
32 1
            return $this->container->get($id);
33 1
        } catch (NotFoundException $e) {
34 1
            return $this->failoverContainer->get($id);
35
        }
36
    }
37
}
38