コード例 #1
0
ファイル: every.php プロジェクト: mpetrovich/dash
function every($collection, $predicate)
{
    if (isEmpty($collection)) {
        return true;
    }
    return !any($collection, Functions\negate($predicate));
}
コード例 #2
0
ファイル: negateTest.php プロジェクト: mpetrovich/dash
 public function testNegateInChain()
 {
     $isPositive = function ($value) {
         return $value > 0;
     };
     $container = new Container(array(2, -3, 5, -8));
     $negatives = $container->filter(Functions\negate($isPositive))->values()->value();
     $this->assertEquals(array(-3, -8), $negatives);
 }
コード例 #3
0
ファイル: reject.php プロジェクト: mpetrovich/dash
function reject($collection, $predicate)
{
    return filter($collection, Functions\negate($predicate));
}