FetchMethods::leaveNode()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
3
/**
4
 * Spiral Framework. Cycle ProxyFactory
5
 *
6
 * @license MIT
7
 * @author  Valentin V (vvval)
8
 */
9
10
declare(strict_types=1);
11
12
namespace Cycle\ORM\Promise\Visitor\Declaration;
13
14
use PhpParser\Node;
15
use PhpParser\NodeVisitorAbstract;
16
17
final class FetchMethods extends NodeVisitorAbstract
18
{
19
    /** @var Node\Stmt\ClassMethod[] */
20
    private $methods = [];
21
22
    /**
23
     * {@inheritDoc}
24
     */
25
    public function leaveNode(Node $node)
26
    {
27
        if ($node instanceof Node\Stmt\ClassMethod) {
28
            $this->methods[(string)$node->name] = $node;
29
        }
30
31
        return null;
32
    }
33
34
    /**
35
     * @return Node\Stmt\ClassMethod[]
36
     */
37
    public function getMethods(): array
38
    {
39
        return $this->methods;
40
    }
41
}
42