public function ArrayCollection::forAll

Applies the given predicate p to all elements of this collection, returning true, if the predicate yields true for all elements.

Parameters

Closure $p The predicate.:

Return value

boolean TRUE, if the predicate yields TRUE for all elements, FALSE otherwise.

Overrides Collection::forAll

File

drupal/core/vendor/doctrine/common/lib/Doctrine/Common/Collections/ArrayCollection.php, line 396

Class

ArrayCollection
An ArrayCollection is a Collection implementation that wraps a regular PHP array.

Namespace

Doctrine\Common\Collections

Code

public function forAll(Closure $p) {
  foreach ($this->_elements as $key => $element) {
    if (!$p($key, $element)) {
      return false;
    }
  }
  return true;
}