public function Functions::execute in Drupal 7 to 8/9 Module Upgrader 8
Overrides IndexerExecutionInterface::execute
File
- src/
Plugin/ DMU/ Indexer/ Functions.php, line 171
Class
- Functions
- Plugin annotation @Indexer( id = "function" )
Namespace
Drupal\drupalmoduleupgrader\Plugin\DMU\IndexerCode
public function execute($identifier, array $arguments = []) {
$function = $this
->prepareID($identifier);
// If the function already exists, we can safely assume that it's already
// been scanned for dangerous logic and evaluated into existence.
if (function_exists($function)) {
return call_user_func_array($function, $arguments);
}
else {
if ($this
->hasExecutable($function)) {
eval($this
->get($function)
->get(0)
->getText());
return $this
->execute($function, $arguments);
}
else {
$variables = [
'@function' => $function,
];
throw new \LogicException((new FormattableMarkup('Cowardly refusing to execute @function.', $variables))
->__toString());
}
}
}