You are here

public static function Inspector::assertAllNotEmpty in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Component/Assertion/Inspector.php \Drupal\Component\Assertion\Inspector::assertAllNotEmpty()

Asserts that all members are not empty.

Parameters

mixed $traversable: Variable to be examined.

Return value

bool TRUE if $traversable can be traversed and all members not empty.

1 call to Inspector::assertAllNotEmpty()
InspectorTest::testAllNotEmpty in core/tests/Drupal/Tests/Component/Assertion/InspectorTest.php
Tests asserting all members are !empty().

File

core/lib/Drupal/Component/Assertion/Inspector.php, line 272

Class

Inspector
Generic inspections for the assert() statement.

Namespace

Drupal\Component\Assertion

Code

public static function assertAllNotEmpty($traversable) {
  if (static::assertTraversable($traversable)) {
    foreach ($traversable as $member) {
      if (empty($member)) {
        return FALSE;
      }
    }
    return TRUE;
  }
  return FALSE;
}