Parkour\Traverse::some PHP Method

some() public static method

Returns true if some elements of the given data passes a thruth test.
public static some ( array $data, callable $cb ) : boolean
$data array Data.
$cb callable Test.
return boolean If some elements passes the test.
    public static function some(array $data, callable $cb)
    {
        foreach ($data as $key => $value) {
            if (call_user_func($cb, $value, $key)) {
                return true;
            }
        }
        return false;
    }

Usage Example

 /**
  *
  */
 public function testSome()
 {
     $data = [1, 2];
     $closure = $this->closure([[1, 0, false], [2, 1, false]]);
     $this->assertFalse(Traverse::some($data, $closure));
     $closure = $this->closure([[1, 0, true]]);
     $this->assertTrue(Traverse::some($data, $closure));
 }