Test Setup Failed
Push — master ( 4d8696...980fb9 )
by Valentin
05:05
created

FetchMethods   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 25
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A leaveNode() 0 8 2
A getMethods() 0 4 1
1
<?php
2
3
/**
4
 * PHP Data Grid Source
5
 *
6
 * @license MIT
7
 * @author  Valentin V (vvval)
8
 */
9
declare(strict_types=1);
10
11
namespace Cycle\ORM\Promise\Visitor\Declaration;
12
13
use PhpParser\Node;
14
use PhpParser\NodeVisitorAbstract;
15
16
class FetchMethods extends NodeVisitorAbstract
17
{
18
    /** @var Node\Stmt\ClassMethod[] */
19
    private $methods = [];
20
21
    /**
22
     * {@inheritDoc}
23
     */
24
    public function leaveNode(Node $node)
25
    {
26
        if ($node instanceof Node\Stmt\ClassMethod) {
27
            $this->methods[(string)$node->name] = $node;
28
        }
29
30
        return null;
31
    }
32
33
    /**
34
     * @return Node\Stmt\ClassMethod[]
35
     */
36
    public function getMethods(): array
37
    {
38
        return $this->methods;
39
    }
40
}
41