public function Functions::addFile in Drupal 7 to 8/9 Module Upgrader 8
Overrides IndexerInterface::addFile
File
- src/
Plugin/ DMU/ Indexer/ Functions.php, line 51
Class
- Functions
- Plugin annotation @Indexer( id = "function" )
Namespace
Drupal\drupalmoduleupgrader\Plugin\DMU\IndexerCode
public function addFile($path) {
if (!class_exists('Pharborist\\Parser')) {
\Drupal::logger("Drupalmoduleupgrader")
->error("Have you ran 'composer up' in the drupalmoduleupgrader folder yet?", [
"missing",
]);
throw new \Exception("The Pharborist\\Parser class was not found, please make sure to run 'composer up' in the drupalmoduleupgrader folder and try again.");
}
$doc = Parser::parseFile($path);
$doc
->children(Filter::isInstanceOf('\\Pharborist\\Functions\\FunctionDeclarationNode'))
->each([
$this,
'add',
]);
$doc
->find(Filter::isInstanceOf('\\Pharborist\\Functions\\FunctionCallNode'))
->each([
$this,
'add',
]);
}