Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. StatusCheckTrait.php

trait StatusCheckTrait

Contains helper methods to run status checks on a stage.

@internal This is an internal part of Package Manager and may be changed or removed at any time without warning. External code should not use or interact with this trait.

Hierarchy

  • trait \Drupal\package_manager\StatusCheckTrait

File

core/modules/package_manager/src/StatusCheckTrait.php, line 20

Namespace

Drupal\package_manager
View source
trait StatusCheckTrait {
    
    /**
     * Runs a status check for a stage and returns the results, if any.
     *
     * @param \Drupal\package_manager\StageBase $stage
     *   The stage to run the status check for.
     * @param \Symfony\Contracts\EventDispatcher\EventDispatcherInterface|null $event_dispatcher
     *   (optional) The event dispatcher service.
     * @param \Drupal\package_manager\PathLocator|null $path_locator
     *   (optional) The path locator service.
     * @param \PhpTuf\ComposerStager\API\Path\Factory\PathFactoryInterface|null $path_factory
     *   (optional) The path factory service.
     *
     * @return \Drupal\package_manager\ValidationResult[]
     *   The results of the status check. If a readiness check was also done,
     *   its results will be included.
     */
    protected function runStatusCheck(StageBase $stage, ?EventDispatcherInterface $event_dispatcher = NULL, ?PathLocator $path_locator = NULL, ?PathFactoryInterface $path_factory = NULL) : array {
        $event_dispatcher ??= \Drupal::service('event_dispatcher');
        $path_locator ??= \Drupal::service(PathLocator::class);
        $path_factory ??= \Drupal::service(PathFactoryInterface::class);
        try {
            $paths_to_exclude_event = new CollectPathsToExcludeEvent($stage, $path_locator, $path_factory);
            $event_dispatcher->dispatch($paths_to_exclude_event);
        } catch (\Throwable $throwable) {
            $paths_to_exclude_event = $throwable;
        }
        $event = new StatusCheckEvent($stage, $paths_to_exclude_event);
        return $event_dispatcher->dispatch($event)
            ->getResults();
    }

}

Members

Title Sort descending Modifiers Object type Summary
StatusCheckTrait::runStatusCheck protected function Runs a status check for a stage and returns the results, if any.

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal