ThemeGetRegistry.php in Drupal 7 to 8/9 Module Upgrader 8
File
src/Plugin/DMU/Converter/Functions/ThemeGetRegistry.php
View source
<?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;
class ThemeGetRegistry extends FunctionCallModifier {
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');
}
}