You are here

public function CToolsGetPlugins::canRewrite in Drupal 7 to 8/9 Module Upgrader 8

Tests if the function call can be rewritten at all, which it will be only if both arguments are strings, and the first argument is the machine name of the target module.

Parameters

\Pharborist\Functions\FunctionCallNode $call: The function call to test.

\Drupal\drupalmoduleupgrader\TargetInterface $target: The target module.

Return value

bool

1 call to CToolsGetPlugins::canRewrite()
CToolsGetPlugins::rewrite in src/Plugin/DMU/Converter/Functions/CToolsGetPlugins.php
Tries to rewrite the original function call.

File

src/Plugin/DMU/Converter/Functions/CToolsGetPlugins.php, line 30

Class

CToolsGetPlugins
Plugin annotation @Converter( id = "ctools_get_plugins", description = @Translation("Rewrites calls to ctools_get_plugins().") )

Namespace

Drupal\drupalmoduleupgrader\Plugin\DMU\Converter\Functions

Code

public function canRewrite(FunctionCallNode $call, TargetInterface $target) {
  $arguments = $call
    ->getArguments();
  return $arguments[0] instanceof StringNode && $arguments[0]
    ->toValue() == $target
    ->id() && $arguments[1] instanceof StringNode;
}