public function HookPermission::analyze in Drupal 7 to 8/9 Module Upgrader 8
Analyzes a target module and flags any issues found.
Parameters
TargetInterface $target: The target module.
Return value
\Drupal\drupalmoduleupgrader\IssueInterface[]
Overrides AnalyzerInterface::analyze
File
- src/
Plugin/ DMU/ Analyzer/ HookPermission.php, line 31
Class
- HookPermission
- Plugin annotation @Analyzer( id = "hook_permission", description = @Translation("Analyzes implementations of hook_permission()."), documentation = { { "url" = "https://www.drupal.org/node/2311427", "title" = @Translation("Defining…
Namespace
Drupal\drupalmoduleupgrader\Plugin\DMU\AnalyzerCode
public function analyze(TargetInterface $target) {
$issues = [];
$indexer = $target
->getIndexer('function');
if ($indexer
->hasExecutable('hook_permission')) {
$issues[] = $this
->buildIssue($target)
->addViolation($indexer
->get('hook_permission'), $this)
->addFix('hook_to_YAML', [
'hook' => 'permission',
'destination' => '~/' . $target
->id() . '.permissions.yml',
]);
}
return $issues;
}