3 namespace Drupal\drupalmoduleupgrader\Plugin\DMU\Converter\Functions;
5 use Drupal\drupalmoduleupgrader\TargetInterface;
6 use Pharborist\Functions\FunctionCallNode;
7 use Pharborist\Objects\ClassMethodCallNode;
11 * id = "entity_get_info",
12 * description = @Translation("Rewrites calls to entity_get_info().")
15 class EntityGetInfo extends FunctionCallModifier {
20 public function rewrite(FunctionCallNode $call, TargetInterface $target) {
21 $manager = ClassMethodCallNode::create('\Drupal', 'entityManager');
23 $arguments = $call->getArguments();
24 if ($arguments->isEmpty()) {
25 return $manager->appendMethodCall('getDefinitions');
27 elseif (sizeof($arguments) == 1) {
29 ->appendMethodCall('getDefinition')
30 ->appendArgument(clone $arguments[0]);