Completed
Push — 8.x-1.x ( 5d8f74...bc9e07 )
by Frédéric G.
28s queued 11s
created

FunctionCallVisitor   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
eloc 5
c 1
b 0
f 1
dl 0
loc 23
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A enterNode() 0 4 2
A __construct() 0 2 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Drupal\qa\Plugin\QaCheck\Dependencies;
6
7
use PhpParser\Node\Expr\FuncCall;
8
use PhpParser\NodeVisitorAbstract;
9
use PhpParser\Node;
10
11
/**
12
 * Class FunctionCallVisitor extract the names of called functions.
13
 *
14
 * @see \Drupal\qa\Plugin\QaCheck\Dependencies\Undeclared::functionCalls()
15
 */
16
class FunctionCallVisitor extends NodeVisitorAbstract {
17
18
  /**
19
   * The visitor write pad.
20
   *
21
   * @var array
22
   */
23
  public $pad;
24
25
  /**
26
   * FunctionCallVisitor constructor.
27
   */
28
  public function __construct() {
29
    $this->pad = [];
30
  }
31
32
  /**
33
   * {@inheritdoc}
34
   */
35
  public function enterNode(Node $node) {
36
    // Method calls need a different handling, using MethodCall.
37
    if ($node instanceof FuncCall) {
38
      $this->pad[] = implode('\\', $node->name->parts);
39
    }
40
  }
41
42
}
43