You are here

protected function DiagnosticsService::filter in Purge 8.3

Get checks filtered by severity.

Parameters

int[] $severities: Non-associative list of severity integers to retrieve.

Return value

\ArrayIterator \Iterator object that yields DiagnosticCheckInterface instances.

5 calls to DiagnosticsService::filter()
DiagnosticsService::filterErrors in src/Plugin/Purge/DiagnosticCheck/DiagnosticsService.php
Get only SEVERITY_ERROR level checks.
DiagnosticsService::filterInfo in src/Plugin/Purge/DiagnosticCheck/DiagnosticsService.php
Get only SEVERITY_INFO level checks.
DiagnosticsService::filterOk in src/Plugin/Purge/DiagnosticCheck/DiagnosticsService.php
Get only SEVERITY_OK level checks.
DiagnosticsService::filterWarningAndErrors in src/Plugin/Purge/DiagnosticCheck/DiagnosticsService.php
Get only SEVERITY_WARNING and SEVERITY_ERROR level checks.
DiagnosticsService::filterWarnings in src/Plugin/Purge/DiagnosticCheck/DiagnosticsService.php
Get only SEVERITY_WARNING level checks.

File

src/Plugin/Purge/DiagnosticCheck/DiagnosticsService.php, line 72

Class

DiagnosticsService
Provides a service that interacts with diagnostic checks.

Namespace

Drupal\purge\Plugin\Purge\DiagnosticCheck

Code

protected function filter(array $severities) {
  $this
    ->initializePluginInstances();
  $checks = new \ArrayIterator();
  foreach ($this as $check) {
    if (in_array($check
      ->getSeverity(), $severities)) {
      $checks
        ->append($check);
    }
  }
  return $checks;
}