class FunctionCallDeriver in Drupal 7 to 8/9 Module Upgrader 8
Hierarchy
- class \Drupal\drupalmoduleupgrader\DeriverBase implements ContainerDeriverInterface uses StringTranslationTrait
- class \Drupal\drupalmoduleupgrader\Plugin\DMU\Analyzer\FunctionCallDeriver
Expanded class hierarchy of FunctionCallDeriver
File
- src/
Plugin/ DMU/ Analyzer/ FunctionCallDeriver.php, line 9
Namespace
Drupal\drupalmoduleupgrader\Plugin\DMU\AnalyzerView source
class FunctionCallDeriver extends DeriverBase {
/**
* @var array
*/
protected $config;
public function __construct(TranslationInterface $translator, array $config) {
parent::__construct($translator);
$this->config = $config;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, $base_plugin_id) {
return new static($container
->get('string_translation'), $container
->get('config.factory')
->get('drupalmoduleupgrader.functions')
->get('definitions'));
}
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_definition) {
$derivatives = [];
foreach ($this->config as $key => $info) {
// $key can either be the name of a single function, or an arbitrary string
// identifying a group of functions to handle.
if (empty($info['functions'])) {
$info['functions'] = [
$key,
];
}
foreach ($info['functions'] as $function) {
$variables = [
'@function' => $function . '()',
];
$derivative = array_merge($base_definition, $info);
$derivative['function'] = $function;
$derivative['message'] = $this
->t($derivative['message'], $variables);
$derivative['description'] = $this
->t('Analyzes calls to @function.', $variables);
foreach ($derivative['documentation'] as &$doc) {
$doc['title'] = $this
->t($doc['title'], $variables);
}
unset($derivative['functions']);
$derivatives[$function] = $derivative;
}
}
return $derivatives;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DeriverBase:: |
public | function |
Gets the definition of a derivative plugin. Overrides DeriverInterface:: |
|
FunctionCallDeriver:: |
protected | property | ||
FunctionCallDeriver:: |
public static | function |
Creates a new class instance. Overrides DeriverBase:: |
|
FunctionCallDeriver:: |
public | function |
Gets the definition of all derivatives of a base plugin. Overrides DeriverInterface:: |
|
FunctionCallDeriver:: |
public | function |
Overrides DeriverBase:: |
|
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |