function AbstractCollection::where
Return value
CollectionInterface<T>
Throws
InvalidPropertyOrMethod if the $propertyOrMethod does not exist on the elements in this collection.
UnsupportedOperationException if unable to call where() on this collection.
Overrides CollectionInterface::where
File
-
vendor/
ramsey/ collection/ src/ AbstractCollection.php, line 207
Class
- AbstractCollection
- This class provides a basic implementation of `CollectionInterface`, to minimize the effort required to implement this interface
Namespace
Ramsey\CollectionCode
public function where(?string $propertyOrMethod, mixed $value) : CollectionInterface {
return $this->filter(function (mixed $item) use ($propertyOrMethod, $value) : bool {
/** @var mixed $accessorValue */
$accessorValue = $this->extractValue($item, $propertyOrMethod);
return $accessorValue === $value;
});
}