$array = array('a', true, 'c'); $any = Arrays::any($array, function ($element) { return is_bool($element); });
true
public function join() { $any = Arrays::any($this->_query->joinClauses, function (JoinClause $joinClause) { return Strings::equalsIgnoreCase($joinClause->type, 'RIGHT'); }); if ($any) { throw new BadMethodCallException('RIGHT JOIN is not supported in sqlite3'); } return parent::join(); }
private static function _buildWhereKeyIn($column, array $array) { $useRestrictions = Arrays::any($array, Functions::isInstanceOf('\\Ouzo\\Restriction\\Restriction')); if ($useRestrictions) { return DialectUtil::joinClauses($array, 'OR', function (Restriction $restriction) use($column) { return $restriction->toSql($column); }); } $in = implode(', ', array_fill(0, count($array), '?')); return $column . ' IN (' . $in . ')'; }
public function excludes() { $elements = func_get_args(); $currentArray = $this->actual; $foundElement = ''; $anyFound = Arrays::any($elements, function ($element) use($currentArray, &$foundElement) { $checkInArray = Arrays::contains($currentArray, $element); if ($checkInArray) { $foundElement = $element; } return $checkInArray; }); AssertAdapter::assertFalse($anyFound, "Found element {$foundElement} in array {$this->actualString}"); return $this; }
private function isAlreadyAddedToFetch(RelationToFetch $relationToFetch) { return Arrays::any($this->_relationsToFetch, RelationToFetch::equalsPredicate($relationToFetch)); }
private static function whereClauseNeverSatisfied($whereClauses) { return Arrays::any($whereClauses, function (WhereClause $whereClause) { return $whereClause->isNeverSatisfied(); }); }
/** * @test */ public function shouldCheckIsAnyIsBool() { //given $array = array('a', true, 'c'); //when $any = Arrays::any($array, function ($element) { return is_bool($element); }); //then $this->assertTrue($any); }
private static function existRouteRule($methods, $uri) { $routeKeys = Route::$routeKeys; return Arrays::any($methods, function ($method) use($routeKeys, $uri) { return Arrays::keyExists($routeKeys, $method . $uri); }); }