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 ( e9c651...e1baf6 )
by Christian
02:19
created

AbstractListener   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 5
eloc 10
dl 0
loc 25
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A containsTrait() 0 17 5
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * (c) Christian Gripp <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Core23\Doctrine\EventListener\ORM;
13
14
use Doctrine\Common\EventSubscriber;
15
use ReflectionClass;
16
17
abstract class AbstractListener implements EventSubscriber
18
{
19
    /**
20
     * @param ReflectionClass $reflection
21
     * @param string          $class
22
     *
23
     * @return bool
24
     */
25
    final protected function containsTrait(ReflectionClass $reflection, string $class): bool
26
    {
27
        do {
28
            $traits = $reflection->getTraitNames();
29
30
            if (\in_array($class, $traits)) {
31
                return true;
32
            }
33
34
            foreach ($reflection->getTraits() as $reflTraits) {
35
                if ($this->containsTrait($reflTraits, $class)) {
36
                    return true;
37
                }
38
            }
39
        } while ($reflection = $reflection->getParentClass());
40
41
        return false;
42
    }
43
}
44