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::__invoke()   B

Complexity

Conditions 5
Paths 5

Size

Total Lines 16
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 5

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 16
ccs 10
cts 10
cp 1
rs 8.8571
cc 5
eloc 10
nc 5
nop 1
crap 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