Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
3 / 3
CRAP
100.00% covered (success)
100.00%
1 / 1
VisitorsEventBase
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
3 / 3
3
100.00% covered (success)
100.00%
1 / 1
 getLabel
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getPlugin
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getWeight
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace Drupal\visitors\Plugin;
4
5use Drupal\Component\Plugin\PluginBase;
6use Drupal\Core\StringTranslation\StringTranslationTrait;
7use Drupal\visitors\VisitorsEventPluginInterface;
8
9/**
10 * Base class for Visitors event plugins.
11 */
12abstract class VisitorsEventBase extends PluginBase implements VisitorsEventPluginInterface {
13
14  use StringTranslationTrait;
15
16  /**
17   * {@inheritdoc}
18   */
19  public function getLabel(): string {
20    return $this->pluginDefinition['label'];
21  }
22
23  /**
24   * {@inheritdoc}
25   */
26  public function getPlugin(): string {
27    return $this->pluginDefinition['plugin'] ?? static::class;
28  }
29
30  /**
31   * {@inheritdoc}
32   */
33  public function getWeight(): int {
34    return $this->pluginDefinition['weight'] ?? 0;
35  }
36
37}