Further modules included.
[yaffs-website] / web / modules / contrib / drupalmoduleupgrader / src / AnalyzerBase.php
1 <?php
2
3 namespace Drupal\drupalmoduleupgrader;
4
5 /**
6  * Base class for analyzers.
7  */
8 abstract class AnalyzerBase extends PluginBase implements AnalyzerInterface {
9
10   /**
11    * Creates an issue with title, summary, documentation and tags pulled from
12    * the plugin definition.
13    *
14    * @param TargetInterface $target
15    *  The target module.
16    *
17    * @return IssueInterface
18    */
19   protected function buildIssue(TargetInterface $target) {
20     $issue = new Issue($target, $this->pluginDefinition['message'], $this->pluginDefinition['summary']);
21
22     foreach ($this->pluginDefinition['documentation'] as $doc) {
23       $issue->addDocumentation($doc['url'], $doc['title']);
24     }
25
26     foreach ($this->pluginDefinition['tags'] as $group => $tag) {
27       $issue->setTag($group, $tag);
28     }
29
30     // If the plugin definition didn't supply an error_level tag, mark this
31     // one as an error.
32     if (empty($this->pluginDefinition['tags']['error_level'])) {
33       $issue->setTag('error_level', 'error');
34     }
35
36     return $issue;
37   }
38
39 }