Further modules included.
[yaffs-website] / web / modules / contrib / drupalmoduleupgrader / src / Plugin / DMU / Analyzer / PSR4.php
1 <?php
2
3 namespace Drupal\drupalmoduleupgrader\Plugin\DMU\Analyzer;
4
5 use Drupal\drupalmoduleupgrader\AnalyzerBase;
6 use Drupal\drupalmoduleupgrader\TargetInterface;
7
8 /**
9  * @Analyzer(
10  *  id = "PSR4",
11  *  description = @Translation("Checks if the module defines any classes that need to be moved into a PSR-4 structure."),
12  *  documentation = {
13  *    {
14  *      "url" = "https://www.drupal.org/node/2246699",
15  *      "title" = @Translation("PSR-4 compatible class loader in Drupal core")
16  *    }
17  *  },
18  *  tags = {
19  *    "category" = { "misc", "system" }
20  *  },
21  *  message = @Translation("Classes must be PSR-4 compliant.")
22  * )
23  */
24 class PSR4 extends AnalyzerBase {
25
26   /**
27    * {@inheritdoc}
28    */
29   public function analyze(TargetInterface $target) {
30     $issues = [];
31     $class_count = $target
32       ->getIndexer('class')
33       ->getQuery()
34       ->condition('type', 'Pharborist\Objects\ClassNode')
35       ->countQuery()
36       ->execute()
37       ->fetchField();
38
39     if ($class_count > 0) {
40       $issues[] = $this->buildIssue($target);
41     }
42
43     return $issues;
44   }
45
46 }