You are here

protected static function PHPUnit_Util_GlobalState::arrayOnlyContainsScalars in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/phpunit/phpunit/src/Util/GlobalState.php \PHPUnit_Util_GlobalState::arrayOnlyContainsScalars()
1 call to PHPUnit_Util_GlobalState::arrayOnlyContainsScalars()
PHPUnit_Util_GlobalState::exportVariable in vendor/phpunit/phpunit/src/Util/GlobalState.php

File

vendor/phpunit/phpunit/src/Util/GlobalState.php, line 174

Class

PHPUnit_Util_GlobalState
@since Class available since Release 3.4.0

Code

protected static function arrayOnlyContainsScalars(array $array) {
  $result = true;
  foreach ($array as $element) {
    if (is_array($element)) {
      $result = self::arrayOnlyContainsScalars($element);
    }
    elseif (!is_scalar($element) && !is_null($element)) {
      $result = false;
    }
    if ($result === false) {
      break;
    }
  }
  return $result;
}