You are here

public function ReadinessCheckerManager::addChecker in Automatic Updates 8

Appends a checker to the checker chain.

Parameters

\Drupal\automatic_updates\ReadinessChecker\ReadinessCheckerInterface $checker: The checker interface to be appended to the checker chain.

string $category: (optional) The category of check.

int $priority: (optional) The priority of the checker being added.

Return value

$this

Overrides ReadinessCheckerManagerInterface::addChecker

File

src/ReadinessChecker/ReadinessCheckerManager.php, line 53

Class

ReadinessCheckerManager
Defines a chained readiness checker implementation combining multiple checks.

Namespace

Drupal\automatic_updates\ReadinessChecker

Code

public function addChecker(ReadinessCheckerInterface $checker, $category = 'warning', $priority = 0) {
  if (!in_array($category, $this
    ->getCategories(), TRUE)) {
    throw new \InvalidArgumentException(sprintf('Readiness checker category "%s" is invalid. Use "%s" instead.', $category, implode('" or "', $this
      ->getCategories())));
  }
  $this->checkers[$category][$priority][] = $checker;
  return $this;
}