function RulesUiDefinition::validate

Validates the set property values.

Throws

\Drupal\rules\Exception\LogicException Thrown if the set object properties are not valid.

File

src/Ui/RulesUiDefinition.php, line 146

Class

RulesUiDefinition
Class for rules_ui plugin definitions.

Namespace

Drupal\rules\Ui

Code

public function validate() {
    if (!isset($this->id)) {
        throw new LogicException("Missing the required property 'id'.");
    }
    foreach ([
        'label',
        'class',
        'provider',
        'base_route',
    ] as $required) {
        if (!isset($this->{$required})) {
            throw new LogicException("Plugin {$this->id} misses the required property '{$required}'.");
        }
    }
    if (!is_subclass_of($this->class, RulesUiHandlerInterface::class)) {
        throw new LogicException("The provided class does not implement the RulesUiHandlerInterface.");
    }
}