CacheGet.php in Drupal 7 to 8/9 Module Upgrader 8
File
src/Plugin/DMU/Converter/Functions/CacheGet.php
View source
<?php
namespace Drupal\drupalmoduleupgrader\Plugin\DMU\Converter\Functions;
use Drupal\drupalmoduleupgrader\TargetInterface;
use Pharborist\Functions\FunctionCallNode;
use Pharborist\Objects\ClassMethodCallNode;
class CacheGet extends FunctionCallModifier {
public function rewrite(FunctionCallNode $call, TargetInterface $target) {
$arguments = $call
->getArguments();
$get = ClassMethodCallNode::create('\\Drupal', 'cache');
if (sizeof($arguments) == 2) {
$get
->appendArgument(clone $arguments[1]);
}
return $get
->appendMethodCall('get')
->appendArgument(clone $arguments[0]);
}
}
Classes
Name |
Description |
CacheGet |
Plugin annotation
@Converter(
id = "cache_get",
description = @Translation("Rewrites calls to cache_get().")
) |