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.
Completed
Push — master ( 0268aa...3ec9bd )
by cao
05:24
created

CommandAnnotationHandler   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Test Coverage

Coverage 93.94%

Importance

Changes 0
Metric Value
dl 0
loc 43
ccs 31
cts 33
cp 0.9394
rs 10
c 0
b 0
f 0
wmc 5
lcom 0
cbo 5

1 Method

Rating   Name   Duplication   Size   Complexity  
B __invoke() 0 40 5
1
<?php
2
3
namespace PhpBoot\Console\Annotations;
4
5
use DI\InvokerInterface;
6
use FastRoute\RouteParser\Std;
7
use PhpBoot\Console\Command;
8
use PhpBoot\Console\ConsoleContainer;
9
use PhpBoot\Entity\ContainerFactory;
10
use PhpBoot\Entity\EntityContainerBuilder;
11
use PhpBoot\Metas\ReturnMeta;
12
use PhpBoot\Annotation\AnnotationBlock;
13
use PhpBoot\Annotation\AnnotationTag;
14
use PhpBoot\Entity\MixedTypeContainer;
15
use PhpBoot\Exceptions\AnnotationSyntaxException;
16
use PhpBoot\Metas\ParamMeta;
17
use PhpBoot\Utils\AnnotationParams;
18
19
class CommandAnnotationHandler
20
{
21 1
    public function __invoke(ConsoleContainer $container, $ann, EntityContainerBuilder $entityBuilder)
22
    {
23 1
        $params = new AnnotationParams($ann->description, 2);
24 1
        $target = $ann->parent->name;
25 1
        $name = $params->getParam(0, $target);
26
27
        //获取方法参数信息
28 1
        $rfl =  new \ReflectionClass($container->getClassName());
29 1
        $method = $rfl->getMethod($target);
30 1
        $methodParams = $method->getParameters();
31
32 1
        $command = new Command($target, $name);
33 1
        $command->setDescription($container->getSummary().' : '.$ann->parent->summary);
34 1
        $command->setHelp($ann->parent->description);
35
36
        //设置参数列表
37 1
        $paramsMeta = [];
38 1
        foreach ($methodParams as $param){
39 1
            $paramName = $param->getName();
0 ignored issues
show
Bug introduced by
Consider using $param->name. There is an issue with getName() and APC-enabled PHP versions.
Loading history...
40 1
            $source = "argv.$paramName";
41 1
            $paramClass = $param->getClass();
42 1
            if($paramClass){
43
                $paramClass = $paramClass->getName();
0 ignored issues
show
Bug introduced by
Consider using $paramClass->name. There is an issue with getName() and APC-enabled PHP versions.
Loading history...
44
            }
45 1
            $entityContainer = ContainerFactory::create($entityBuilder, $paramClass);
46 1
            $meta = new ParamMeta($paramName,
47 1
                $source,
48 1
                $paramClass?:'mixed',
49 1
                $param->isOptional(),
50 1
                $param->isOptional()?$param->getDefaultValue():null,
51 1
                $param->isPassedByReference(),
52 1
                null,
53 1
                '',
54
                $entityContainer
55 1
            );
56 1
            $paramsMeta[] = $meta;
57 1
        }
58 1
        $command->setParamMetas($paramsMeta);
59 1
        $container->addCommand($target, $command);
60
    }
61
}