You are here

public static function PluginDefinitionValidator::validateDeriverClass in Plugin 8.2

Validates a plugin deriver class.

Parameters

string $class: A fully qualified class name.

Throws

\InvalidArgumentException Thrown when the class is invalid.

3 calls to PluginDefinitionValidator::validateDeriverClass()
ArrayPluginDefinitionDecorator::setDeriverClass in src/PluginDefinition/ArrayPluginDefinitionDecorator.php
Sets the deriver class.
ArrayPluginDefinitionDecorator::__construct in src/PluginDefinition/ArrayPluginDefinitionDecorator.php
Constructs a new instance.
PluginDefinitionValidatorTest::testValidateDeriverClass in tests/src/Unit/PluginDefinition/PluginDefinitionValidatorTest.php
@covers ::validateDeriverClass @covers ::validateClass

File

src/PluginDefinition/PluginDefinitionValidator.php, line 39

Class

PluginDefinitionValidator
Provides plugin definition validation.

Namespace

Drupal\plugin\PluginDefinition

Code

public static function validateDeriverClass($class) {
  static::validateClass($class);
  if (!is_subclass_of($class, DeriverInterface::class)) {
    throw new \InvalidArgumentException(sprintf('Plugin deriver class %s does not implement required %s.', $class, DeriverInterface::class));
  }
}