public function ArrayCollection::forAll in Plug 7
Tests whether the given predicate p holds for all elements of this collection.
Parameters
Closure $p The predicate.:
Return value
boolean TRUE, if the predicate yields TRUE for all elements, FALSE otherwise.
Overrides Collection::forAll
File
- lib/
doctrine/ collections/ lib/ Doctrine/ Common/ Collections/ ArrayCollection.php, line 301
Class
- ArrayCollection
- An ArrayCollection is a Collection implementation that wraps a regular PHP array.
Namespace
Doctrine\Common\CollectionsCode
public function forAll(Closure $p) {
foreach ($this->elements as $key => $element) {
if (!$p($key, $element)) {
return false;
}
}
return true;
}