find() public method

public find ( callable $condition )
$condition callable
Exemplo n.º 1
0
 public function test_find_returns_false_if_no_match()
 {
     $isOverTen = function (TestClassA $item) {
         return $item->getValue() > 10;
     };
     $result = $this->col->find($isOverTen);
     $this->assertFalse($result);
 }
Exemplo n.º 2
0
 /**
  * Finds and returns the first item in the collection that satisfies the callback.
  *
  * @param callback $condition The condition critera to test each item, requires one argument that represents the Collection item during iteration.
  * @return {{foo}} The first item that satisfied the condition or false if no object was found
  */
 public function find(callable $condition)
 {
     return parent::find($condition);
 }