$array = array(1, 2); $all = Arrays::all($array, function ($element) { return $element < 3; });
true
/** * @return bool */ public function isShittyRound() { $hitsInRound = Hit::where(['game_user_id' => $this->game->current_game_user_id, 'round' => $this->game->round])->fetchAll(); return Arrays::all($hitsInRound, function ($hit) { return !$this->isScored($hit->field, $hit->multiplier); }); }
public function isNeverSatisfied() { return Arrays::all($this->conditions, function (WhereClause $where) { return $where->isNeverSatisfied(); }); }
/** * @test */ public function shouldReturnFalseIfNotAllElementSatisfyPredicate() { //given $array = array(1, 2, 3); //when $all = Arrays::all($array, function ($element) { return $element < 3; }); //then $this->assertFalse($all); }