public static function Inspector::assertAll in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/lib/Drupal/Component/Assertion/Inspector.php \Drupal\Component\Assertion\Inspector::assertAll()
Asserts callback returns TRUE for each member of a traversable.
This is less memory intensive than using array_filter() to build a second array and then comparing the arrays. Many of the other functions in this collection alias this function passing a specific callback to make the code more readable.
Parameters
callable $callable: Callback function.
mixed $traversable: Variable to be examined.
Return value
bool TRUE if $traversable can be traversed and $callable returns TRUE on all members.
See also
http://php.net/manual/language.types.callable.php
7 calls to Inspector::assertAll()
- Inspector::assertAllArrays in core/
lib/ Drupal/ Component/ Assertion/ Inspector.php - Asserts that all members are arrays.
- Inspector::assertAllCallable in core/
lib/ Drupal/ Component/ Assertion/ Inspector.php - Asserts that all members are callable.
- Inspector::assertAllFloat in core/
lib/ Drupal/ Component/ Assertion/ Inspector.php - Asserts that all members are float values.
- Inspector::assertAllIntegers in core/
lib/ Drupal/ Component/ Assertion/ Inspector.php - Asserts that all members are integer values.
- Inspector::assertAllNumeric in core/
lib/ Drupal/ Component/ Assertion/ Inspector.php - Asserts all members are numeric data types or strings castable to such.
File
- core/
lib/ Drupal/ Component/ Assertion/ Inspector.php, line 59 - Contains \Drupal\Component\Assertion\Inspector.
Class
Namespace
Drupal\Component\AssertionCode
public static function assertAll(callable $callable, $traversable) {
if (static::assertTraversable($traversable)) {
foreach ($traversable as $member) {
if (!$callable($member)) {
return FALSE;
}
}
return TRUE;
}
return FALSE;
}