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.
Passed
Push — master ( 9ce6eb...76f604 )
by Carsten
05:02
created

PsrContainerFactory   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
B __invoke() 0 16 5
1
<?php
2
namespace Germania\PsrContainerFactory;
3
4
use Psr\Container\ContainerInterface;
5
use Pimple\Container as PimpleContainer;
6
use Pimple\Psr11\Container as PsrContainer;
7
8
9
/**
10
 * Callable for creating a PSR-11 Container from array, Pimple Container, or ContainerInterface
11
 */
12
class PsrContainerFactory
13
{
14
15
    /**
16
     * @param  array|ContainerInterface|Container $data Array, ContainerInterface or Pimple Container
17
     * @return ContainerInterface       \Pimple\Psr11\Container
18
     */
19 40
    public function __invoke($data)
20
    {
21 40
        if ( is_array($data)) {
22 4
            return new PsrContainer( new PimpleContainer( $data ) );
23
        }
24 36
        elseif ($data instanceOf PimpleContainer) {
25 4
            return new PsrContainer( $data );
26
        }
27 32
        elseif ($data instanceOf ContainerInterface) {
28 4
            return $data;
29
        }
30 28
        elseif ($data instanceOf \StdClass) {
31 4
            return new PsrContainer( new PimpleContainer((array) $data) );
32
        }
33 24
        throw new \InvalidArgumentException( "Expected array, Pimple Container, or PSR ContainerInterface");
34
    }
35
}
36