Passed
Push — master ( d3a94c...76e109 )
by Valentin
05:50
created

LocateMethodsToBeProxied::getMethods()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
declare(strict_types=1);
3
4
namespace Cycle\ORM\Promise\Declaration\Visitor;
5
6
use PhpParser\Node;
7
use PhpParser\NodeVisitorAbstract;
8
9
class LocateMethodsToBeProxied extends NodeVisitorAbstract
10
{
11
    /** @var string[] */
12
    private $methods = [];
13
14
    public function getMethods(): array
15
    {
16
        return $this->methods;
17
    }
18
19
    /**
20
     * {@inheritdoc}
21
     */
22
    public function leaveNode(Node $node)
23
    {
24
        if ($node instanceof Node\Stmt\ClassMethod && !$this->isIgnoredMethod($node)) {
25
            $this->methods[] = $node;
26
        }
27
28
        return null;
29
    }
30
31 View Code Duplication
    private function isIgnoredMethod(Node\Stmt\ClassMethod $node): bool
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
32
    {
33
        if ($node->isPrivate() || $node->isStatic() || $node->isFinal() || $node->isAbstract() || $node->isMagic()) {
34
            return true;
35
        }
36
37
        return false;
38
    }
39
}