You are here

public function PSR4::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/PSR4.php, line 29

Class

PSR4
Plugin annotation @Analyzer( id = "PSR4", description = @Translation("Checks if the module defines any classes that need to be moved into a PSR-4 structure."), documentation = { { "url" = "https://www.drupal.org/node/2246699", "title"…

Namespace

Drupal\drupalmoduleupgrader\Plugin\DMU\Analyzer

Code

public function analyze(TargetInterface $target) {
  $issues = [];
  $class_count = $target
    ->getIndexer('class')
    ->getQuery()
    ->condition('type', 'Pharborist\\Objects\\ClassNode')
    ->countQuery()
    ->execute()
    ->fetchField();
  if ($class_count > 0) {
    $issues[] = $this
      ->buildIssue($target);
  }
  return $issues;
}