Automattic\WooCommerce\Utilities
ArrayUtil::array_all
Check if all items in an array pass a callback.
Метод класса: ArrayUtil{}
Хуков нет.
Возвращает
true|false. true if all items pass the callback, false otherwise.
Использование
$result = ArrayUtil::array_all( $items, $callback ): bool;
- $items(массив) (обязательный)
- The array to check.
- $callback(callable) (обязательный)
- The callback to check each item.
Код ArrayUtil::array_all() ArrayUtil::array all WC 10.5.2
public static function array_all( array $items, callable $callback ): bool {
if ( function_exists( 'array_all' ) ) {
return array_all( $items, $callback );
}
foreach ( $items as $item ) {
if ( ! $callback( $item ) ) {
return false;
}
}
return true;
}