public function FilterCollection::ensure

Checks that the current collection contains the supplied filter.

If the supplied filter is another filter collection, each of its filters will be checked.

1 call to FilterCollection::ensure()
FilterCollection::__construct in drupal/core/vendor/kriswallsmith/assetic/src/Assetic/Filter/FilterCollection.php

File

drupal/core/vendor/kriswallsmith/assetic/src/Assetic/Filter/FilterCollection.php, line 38

Class

FilterCollection
A collection of filters.

Namespace

Assetic\Filter

Code

public function ensure(FilterInterface $filter) {
  if ($filter instanceof \Traversable) {
    foreach ($filter as $f) {
      $this
        ->ensure($f);
    }
  }
  elseif (!in_array($filter, $this->filters, true)) {
    $this->filters[] = $filter;
  }
}