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.

ClassAnnotationHandler::__invoke()   A
last analyzed

Complexity

Conditions 4
Paths 3

Size

Total Lines 21

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 18
CRAP Score 4

Importance

Changes 0
Metric Value
cc 4
nc 3
nop 2
dl 0
loc 21
ccs 18
cts 18
cp 1
crap 4
rs 9.584
c 0
b 0
f 0
1
<?php
2
3
namespace PhpBoot\Entity\Annotations;
4
5
use PhpBoot\Annotation\AnnotationBlock;
6
use PhpBoot\Annotation\AnnotationTag;
7
use PhpBoot\Entity\EntityContainer;
8
use PhpBoot\Metas\PropertyMeta;
9
10
class ClassAnnotationHandler
11
{
12
    /**
13
     * @param EntityContainer $container
14
     * @param AnnotationBlock|AnnotationTag $ann
15
     * @return void
16
     */
17 9
    public function __invoke(EntityContainer $container, $ann)
18
    {
19 9
        $ref = new \ReflectionClass($container->getClassName());
20 9
        $container->getClassName();
0 ignored issues
show
Unused Code introduced by
The call to the method PhpBoot\Entity\EntityContainer::getClassName() seems un-needed as the method has no side-effects.

PHP Analyzer performs a side-effects analysis of your code. A side-effect is basically anything that might be visible after the scope of the method is left.

Let’s take a look at an example:

class User
{
    private $email;

    public function getEmail()
    {
        return $this->email;
    }

    public function setEmail($email)
    {
        $this->email = $email;
    }
}

If we look at the getEmail() method, we can see that it has no side-effect. Whether you call this method or not, no future calls to other methods are affected by this. As such code as the following is useless:

$user = new User();
$user->getEmail(); // This line could safely be removed as it has no effect.

On the hand, if we look at the setEmail(), this method _has_ side-effects. In the following case, we could not remove the method call:

$user = new User();
$user->setEmail('email@domain'); // This line has a side-effect (it changes an
                                 // instance variable).
Loading history...
21 9
        $properties = $ref->getProperties(\ReflectionProperty::IS_PUBLIC);
22 9
        $default = $ref->getDefaultProperties();
23 9
        $container->setFileName($ref->getFileName());
24
25 9
        $container->setDescription($ann->description);
26 9
        $container->setSummary($ann->summary);
27
28 9
        foreach ($properties as $i){
29 9
            $isOption = array_key_exists($i->getName(), $default) && $default[$i->getName()] !==null;
30 9
            $container->setProperty($i->getName(), new PropertyMeta(
31 9
                $i->getName(),
32 9
                null,
33 9
                $isOption,
34 9
                $isOption?$default[$i->getName()]:null
35 9
                ));
36 9
        }
37
    }
38
}