Further modules included.
[yaffs-website] / web / modules / contrib / drupalmoduleupgrader / src / Plugin / DMU / Analyzer / FunctionCall.php
diff --git a/web/modules/contrib/drupalmoduleupgrader/src/Plugin/DMU/Analyzer/FunctionCall.php b/web/modules/contrib/drupalmoduleupgrader/src/Plugin/DMU/Analyzer/FunctionCall.php
new file mode 100644 (file)
index 0000000..c022d9b
--- /dev/null
@@ -0,0 +1,39 @@
+<?php
+
+namespace Drupal\drupalmoduleupgrader\Plugin\DMU\Analyzer;
+
+use Drupal\drupalmoduleupgrader\AnalyzerBase;
+use Drupal\drupalmoduleupgrader\TargetInterface;
+use Pharborist\Functions\FunctionCallNode;
+
+/**
+ * @Analyzer(
+ *  id = "_function_call",
+ *  deriver = "Drupal\drupalmoduleupgrader\Plugin\DMU\Analyzer\FunctionCallDeriver"
+ * )
+ */
+class FunctionCall extends AnalyzerBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function analyze(TargetInterface $target) {
+    $indexer = $target->getIndexer('function_call');
+    $issues = [];
+
+    if ($indexer->has($this->pluginDefinition['function'])) {
+      $issue = $this->buildIssue($target);
+
+      $indexer
+        ->get($this->pluginDefinition['function'])
+        ->each(function(FunctionCallNode $function_call) use ($issue) {
+          $issue->addViolation($function_call, $this);
+        });
+
+      $issues[] = $issue;
+    }
+
+    return $issues;
+  }
+
+}