public function ArrayCollection::contains

Checks whether the given element is contained in the collection. Only element values are compared, not keys. The comparison of two elements is strict, that means not only the value but also the type must match. For objects this means reference equality.

Parameters

mixed $element:

Return value

boolean TRUE if the given element is contained in the collection, FALSE otherwise.

Overrides Collection::contains

File

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

Class

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

Namespace

Doctrine\Common\Collections

Code

public function contains($element) {
  foreach ($this->_elements as $collectionElement) {
    if ($element === $collectionElement) {
      return true;
    }
  }
  return false;
}