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.

ThrowsAnnotationHandler::__invoke()   A
last analyzed

Complexity

Conditions 4
Paths 4

Size

Total Lines 20

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 11
CRAP Score 4.0582

Importance

Changes 0
Metric Value
cc 4
nc 4
nop 2
dl 0
loc 20
ccs 11
cts 13
cp 0.8462
crap 4.0582
rs 9.6
c 0
b 0
f 0
1
<?php
2
3
namespace PhpBoot\Controller\Annotations;
4
5
use PhpBoot\Annotation\AnnotationBlock;
6
use PhpBoot\Annotation\AnnotationTag;
7
use PhpBoot\Controller\ControllerContainer;
8
use PhpBoot\Exceptions\AnnotationSyntaxException;
9
use PhpBoot\Utils\AnnotationParams;
10
use PhpBoot\Utils\Logger;
11
use PhpBoot\Utils\TypeHint;
12
13
class ThrowsAnnotationHandler
14
{
15
16
    /**
17
     * @param ControllerContainer $container
18
     * @param AnnotationBlock|AnnotationTag $ann
19
     */
20 3
    public function __invoke(ControllerContainer $container, $ann)
21
    {
22 3
        if(!$ann->parent){
23
            //Logger::debug("The annotation \"@{$ann->name} {$ann->description}\" of {$container->getClassName()} should be used with parent route");
24
            return;
25
        }
26 3
        $target = $ann->parent->name;
27 3
        $route = $container->getRoute($target);
28 3
        if(!$route){
29
            //Logger::debug("The annotation \"@{$ann->name} {$ann->description}\" of {$container->getClassName()}::$target should be used with parent route");
30
            return ;
31
        }
32 3
        $params = new AnnotationParams($ann->description, 2);
33 3
        count($params)>0 or \PhpBoot\abort(new AnnotationSyntaxException("The annotation \"@{$ann->name} {$ann->description}\" of {$container->getClassName()}::$target require at least one param, {$params->count()} given"));
34
35 3
        $type = TypeHint::normalize($params[0], $container->getClassName()); // TODO 缺少类型时忽略错误
36 3
        $doc = $params->getRawParam(1, '');
37
38 3
        $route->getExceptionHandler()->addExceptions($type, $doc);
39
    }
40
}