Further modules included.
[yaffs-website] / web / modules / contrib / drupalmoduleupgrader / src / Plugin / DMU / Converter / Functions / ThemeGetRegistry.php
diff --git a/web/modules/contrib/drupalmoduleupgrader/src/Plugin/DMU/Converter/Functions/ThemeGetRegistry.php b/web/modules/contrib/drupalmoduleupgrader/src/Plugin/DMU/Converter/Functions/ThemeGetRegistry.php
new file mode 100644 (file)
index 0000000..7319996
--- /dev/null
@@ -0,0 +1,30 @@
+<?php
+
+namespace Drupal\drupalmoduleupgrader\Plugin\DMU\Converter\Functions;
+
+use Drupal\drupalmoduleupgrader\TargetInterface;
+use Pharborist\Functions\FunctionCallNode;
+use Pharborist\Objects\ClassMethodCallNode;
+use Pharborist\Types\FalseNode;
+use Pharborist\Types\StringNode;
+
+/**
+ * @Converter(
+ *  id = "theme_get_registry",
+ *  description = @Translation("Rewrites calls to theme_get_registry().")
+ * )
+ */
+class ThemeGetRegistry extends FunctionCallModifier {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function rewrite(FunctionCallNode $call, TargetInterface $target) {
+    $arguments = $call->getArguments()->toArray();
+
+    return ClassMethodCallNode::create('\Drupal', 'service')
+      ->appendArgument(StringNode::fromValue('theme.registry'))
+      ->appendMethodCall(($arguments && $arguments[0] instanceof FalseNode) ? 'getRuntime' : 'get');
+  }
+
+}