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.

ContainerFactory::create()   A
last analyzed

Complexity

Conditions 5
Paths 2

Size

Total Lines 20

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 12
CRAP Score 5

Importance

Changes 0
Metric Value
cc 5
nc 2
nop 2
dl 0
loc 20
ccs 12
cts 12
cp 1
crap 5
rs 9.2888
c 0
b 0
f 0
1
<?php
2
3
namespace PhpBoot\Entity;
4
5
use PhpBoot\Utils\TypeHint;
6
7
class ContainerFactory
8
{
9
    static public function create(EntityContainerBuilder $builder, $type)
10
    {
11
        //TODO 支持|分隔的多类型
12
13 10
        $getter = function($type)use($builder){
14 10
            if(!$type || $type == 'mixed'){
15 4
                return new MixedTypeContainer();
16 10
            }elseif (TypeHint::isScalarType($type)){
17 8
                return new ScalarTypeContainer($type);
18
            }else{
19 4
                return $builder->build($type);
20
            }
21 10
        };
22 10
        if(TypeHint::isArray($type)){
23 6
            $container = ArrayContainer::create($type, $getter);
24 6
        }else{
25 8
            $container = $getter($type);
26
        }
27 10
        return $container;
28
    }
29
}