You are here

abstract class DeriverBase in Drupal 7 to 8/9 Module Upgrader 8

Base class for DMU's plugin derivers. Sets up the translation service and provides a basic implementation of DeriverInterface::getDerivativeDefinition().

Hierarchy

Expanded class hierarchy of DeriverBase

7 files declare their use of DeriverBase
DBDeriver.php in src/Plugin/DMU/Analyzer/DBDeriver.php
DBDeriver.php in src/Plugin/DMU/Converter/Functions/DBDeriver.php
DisableDeriver.php in src/Plugin/DMU/Converter/Functions/DisableDeriver.php
EntityOperationDeriver.php in src/Plugin/DMU/Converter/Functions/EntityOperationDeriver.php
FlagHookDeriver.php in src/Plugin/DMU/Analyzer/FlagHookDeriver.php

... See full list

File

src/DeriverBase.php, line 14

Namespace

Drupal\drupalmoduleupgrader
View source
abstract class DeriverBase implements ContainerDeriverInterface {
  use StringTranslationTrait;
  public function __construct(TranslationInterface $translator) {
    $this->stringTranslation = $translator;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, $base_plugin_id) {
    return new static($container
      ->get('string_translation'));
  }

  /**
   * {@inheritdoc}
   */
  public function getDerivativeDefinition($derivative_id, $base_definition) {
    $derivatives = $this
      ->getDerivativeDefinitions($base_definition);
    if (isset($derivatives[$derivative_id])) {
      return $derivatives[$derivative_id];
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DeriverBase::create public static function Creates a new class instance. Overrides ContainerDeriverInterface::create 3
DeriverBase::getDerivativeDefinition public function Gets the definition of a derivative plugin. Overrides DeriverInterface::getDerivativeDefinition
DeriverBase::__construct public function 3
DeriverInterface::getDerivativeDefinitions public function Gets the definition of all derivatives of a base plugin. 14
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.