function RecipeMissingExtensionsException::__construct

Same name in other branches
  1. 11.x core/lib/Drupal/Core/Recipe/RecipeMissingExtensionsException.php \Drupal\Core\Recipe\RecipeMissingExtensionsException::__construct()

Constructs a RecipeMissingExtensionsException.

Parameters

array $extensions: The list of missing extensions.

string $message: [optional] The Exception message to throw.

int $code: [optional] The Exception code.

null|\Throwable $previous: [optional] The previous throwable used for the exception chaining.

File

core/lib/Drupal/Core/Recipe/RecipeMissingExtensionsException.php, line 29

Class

RecipeMissingExtensionsException
Exception thrown when recipes contain or depend on missing extensions.

Namespace

Drupal\Core\Recipe

Code

public function __construct(array $extensions, string $message = "", int $code = 0, ?\Throwable $previous = NULL) {
    assert(Inspector::assertAllStrings($extensions), 'Extension names must be strings.');
    if (!$message) {
        $sorted = $this->extensions;
        sort($sorted);
        $message = sprintf("The following extensions are missing and are required for this recipe: %s", implode(", ", $sorted));
    }
    parent::__construct($message, $code, $previous);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.