function DeepCopy::first
Returns first element that matches predicate, `null` if no such element found.
Parameters
array $elements Array of ['filter' => Filter, 'matcher' => Matcher] pairs.:
callable $predicate Predicate arguments are: element.:
Return value
array|null Associative array with 2 members: 'filter' with value of type {@see TypeFilter} and 'matcher' with value of type {@see TypeMatcher} or `null`.
1 call to DeepCopy::first()
- DeepCopy::getFirstMatchedTypeFilter in vendor/
myclabs/ deep-copy/ src/ DeepCopy/ DeepCopy.php - Returns first filter that matches variable, `null` if no such filter found.
File
-
vendor/
myclabs/ deep-copy/ src/ DeepCopy/ DeepCopy.php, line 306
Class
- DeepCopy
- @final
Namespace
DeepCopyCode
private function first(array $elements, callable $predicate) {
foreach ($elements as $element) {
if (call_user_func($predicate, $element)) {
return $element;
}
}
return null;
}