You are here

public function Functions::getUsages in Drupal 7 to 8/9 Module Upgrader 8

Overrides IndexerUsageInterface::getUsages

File

src/Plugin/DMU/Indexer/Functions.php, line 196

Class

Functions
Plugin annotation @Indexer( id = "function" )

Namespace

Drupal\drupalmoduleupgrader\Plugin\DMU\Indexer

Code

public function getUsages($identifier) {
  $function = $this
    ->prepareID($identifier);
  $files = $this
    ->getQuery([
    'file',
  ])
    ->distinct()
    ->condition('id', $function)
    ->condition('type', 'Pharborist\\Functions\\FunctionCallNode')
    ->execute()
    ->fetchCol();
  $usages = new NodeCollection();
  foreach ($files as $file) {
    $this->target
      ->open($file)
      ->find(Filter::isFunctionCall($function))
      ->addTo($usages);
  }
  return $usages;
}