class StatusCheckEvent

Same name and namespace in other branches
  1. 11.x core/modules/package_manager/src/Event/StatusCheckEvent.php \Drupal\package_manager\Event\StatusCheckEvent

Event fired to check the status of the system to use Package Manager.

Hierarchy

Expanded class hierarchy of StatusCheckEvent

20 files declare their use of StatusCheckEvent
AllowedScaffoldPackagesValidator.php in core/modules/package_manager/src/Validator/AllowedScaffoldPackagesValidator.php
BaseRequirementsFulfilledValidator.php in core/modules/package_manager/src/Validator/BaseRequirementsFulfilledValidator.php
BaseRequirementsFulfilledValidatorTest.php in core/modules/package_manager/tests/src/Kernel/BaseRequirementsFulfilledValidatorTest.php
BaseRequirementValidatorTrait.php in core/modules/package_manager/src/Validator/BaseRequirementValidatorTrait.php
ComposerPatchesValidator.php in core/modules/package_manager/src/Validator/ComposerPatchesValidator.php

... See full list

File

core/modules/package_manager/src/Event/StatusCheckEvent.php, line 16

Namespace

Drupal\package_manager\Event
View source
final class StatusCheckEvent extends SandboxValidationEvent {
  
  /**
   * The paths to exclude, or NULL if there was an error collecting them.
   *
   * @var \Drupal\package_manager\ImmutablePathList|null
   *
   * @see ::__construct()
   */
  public readonly ?ImmutablePathList $excludedPaths;
  
  /**
   * Constructs a StatusCheckEvent object.
   *
   * @param \Drupal\package_manager\SandboxManagerBase $sandboxManager
   *   The stage which fired this event.
   * @param \PhpTuf\ComposerStager\API\Path\Value\PathListInterface|\Throwable $excluded_paths
   *   The list of paths to exclude or, if an error occurred while they were
   *   being collected, the throwable from that error. If this is a throwable,
   *   it will be converted to a validation error.
   */
  public function __construct(SandboxManagerBase $sandboxManager, PathListInterface|\Throwable $excluded_paths) {
    parent::__construct($sandboxManager);
    // If there was an error collecting the excluded paths, convert it to a
    // validation error so we can still run status checks that don't need to
    // examine the list of excluded paths.
    if ($excluded_paths instanceof \Throwable) {
      $this->addErrorFromThrowable($excluded_paths);
      $excluded_paths = NULL;
    }
    else {
      $excluded_paths = new ImmutablePathList($excluded_paths);
    }
    $this->excludedPaths = $excluded_paths;
  }
  
  /**
   * Adds warning information to the event.
   *
   * @param \Drupal\Core\StringTranslation\TranslatableMarkup[] $messages
   *   One or more warning messages.
   * @param \Drupal\Core\StringTranslation\TranslatableMarkup|null $summary
   *   A summary of warning messages. Must be passed if there is more than one
   *   message.
   */
  public function addWarning(array $messages, ?TranslatableMarkup $summary = NULL) : void {
    $this->addResult(ValidationResult::createWarning($messages, $summary));
  }
  
  /**
   * {@inheritdoc}
   */
  public function addResult(ValidationResult $result) : void {
    // Override the parent to also allow warnings.
    $this->results[] = $result;
  }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title
SandboxValidationEvent::$results protected property The validation results.
SandboxValidationEvent::addError public function Convenience method to flag a validation error.
SandboxValidationEvent::addErrorFromThrowable public function Convenience method, adds an error validation result from a throwable.
SandboxValidationEvent::getResults public function Gets the validation results.
SandboxValidationEvent::stopPropagation public function
StatusCheckEvent::$excludedPaths public property The paths to exclude, or NULL if there was an error collecting them.
StatusCheckEvent::addResult public function Adds a validation result to the event. Overrides SandboxValidationEvent::addResult
StatusCheckEvent::addWarning public function Adds warning information to the event.
StatusCheckEvent::__construct public function Constructs a StatusCheckEvent object. Overrides SandboxEvent::__construct

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