25 baris
682 B
PHP
25 baris
682 B
PHP
|
<?php
|
||
|
declare(strict_types=1);
|
||
|
namespace Fbrinker\ExtensionCheck\Parser\Visitors;
|
||
|
|
||
|
use PhpParser\Node;
|
||
|
use PhpParser\NodeVisitorAbstract;
|
||
|
|
||
|
class FunctionCollector extends NodeVisitorAbstract implements CollectorInferface {
|
||
|
private $functions = [];
|
||
|
|
||
|
public function getCollected(): array {
|
||
|
$list = array_keys($this->functions);
|
||
|
natcasesort($list);
|
||
|
|
||
|
return array_values($list);
|
||
|
}
|
||
|
|
||
|
public function enterNode(Node $node) {
|
||
|
if ($node instanceof Node\Expr\FuncCall) {
|
||
|
if (!empty($node->name) && $node->name instanceof Node\Name) {
|
||
|
$this->functions[$node->name->toString()] = true;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|