Further modules included.
[yaffs-website] / web / modules / contrib / drupalmoduleupgrader / src / Utility / Filter / FunctionCallArgumentFilter.php
1 <?php
2
3 namespace Drupal\drupalmoduleupgrader\Utility\Filter;
4
5 use Pharborist\Functions\FunctionCallNode;
6 use Pharborist\Node;
7 use Pharborist\Variables\VariableNode;
8
9 /**
10  * Filters for function calls which are passed a particular argument.
11  */
12 class FunctionCallArgumentFilter {
13
14   /**
15    * @var string
16    */
17   protected $variable;
18
19   public function __construct($variable) {
20     $this->variable = $variable;
21   }
22
23   /**
24    * @return boolean
25    */
26   public function __invoke(Node $node) {
27     if ($node instanceof FunctionCallNode) {
28       return (boolean) $node->getArgumentList()->children([$this, 'hasArgument'])->count();
29     }
30     return FALSE;
31   }
32
33   /**
34    * @return boolean
35    */
36   public function hasArgument(Node $argument) {
37     return ($argument instanceof VariableNode && $argument->getName() == $this->variable);
38   }
39
40 }