Further modules included.
[yaffs-website] / web / modules / contrib / drupalmoduleupgrader / src / Plugin / DMU / Converter / Functions / ThemeGetRegistry.php
1 <?php
2
3 namespace Drupal\drupalmoduleupgrader\Plugin\DMU\Converter\Functions;
4
5 use Drupal\drupalmoduleupgrader\TargetInterface;
6 use Pharborist\Functions\FunctionCallNode;
7 use Pharborist\Objects\ClassMethodCallNode;
8 use Pharborist\Types\FalseNode;
9 use Pharborist\Types\StringNode;
10
11 /**
12  * @Converter(
13  *  id = "theme_get_registry",
14  *  description = @Translation("Rewrites calls to theme_get_registry().")
15  * )
16  */
17 class ThemeGetRegistry extends FunctionCallModifier {
18
19   /**
20    * {@inheritdoc}
21    */
22   public function rewrite(FunctionCallNode $call, TargetInterface $target) {
23     $arguments = $call->getArguments()->toArray();
24
25     return ClassMethodCallNode::create('\Drupal', 'service')
26       ->appendArgument(StringNode::fromValue('theme.registry'))
27       ->appendMethodCall(($arguments && $arguments[0] instanceof FalseNode) ? 'getRuntime' : 'get');
28   }
29
30 }