You are here

trait ExcludedPathsTrait in Automatic Updates 8.2

Common functionality for events which can collect excluded paths.

Hierarchy

File

src/Event/ExcludedPathsTrait.php, line 8

Namespace

Drupal\automatic_updates\Event
View source
trait ExcludedPathsTrait {

  /**
   * Paths to exclude from the update.
   *
   * @var string[]
   */
  protected $excludedPaths = [];

  /**
   * Adds an absolute path to exclude from the update operation.
   *
   * @todo This should only accept paths relative to the active directory.
   *
   * @param string $path
   *   The path to exclude.
   */
  public function excludePath(string $path) : void {
    $this->excludedPaths[] = $path;
  }

  /**
   * Returns the paths to exclude from the update operation.
   *
   * @return string[]
   *   The paths to exclude.
   */
  public function getExcludedPaths() : array {
    return array_unique($this->excludedPaths);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ExcludedPathsTrait::$excludedPaths protected property Paths to exclude from the update.
ExcludedPathsTrait::excludePath public function Adds an absolute path to exclude from the update operation.
ExcludedPathsTrait::getExcludedPaths public function Returns the paths to exclude from the update operation.