You are here

public static function GuardUtils::guardAgainstEmpty in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/zendframework/zend-stdlib/src/Guard/GuardUtils.php \Zend\Stdlib\Guard\GuardUtils::guardAgainstEmpty()

Verify that the data is not empty

Parameters

mixed $data the data to verify:

string $dataName the data name:

string $exceptionClass FQCN for the exception:

Throws

\Exception

File

vendor/zendframework/zend-stdlib/src/Guard/GuardUtils.php, line 56

Class

GuardUtils
Static guard helper class

Namespace

Zend\Stdlib\Guard

Code

public static function guardAgainstEmpty($data, $dataName = 'Argument', $exceptionClass = self::DEFAULT_EXCEPTION_CLASS) {
  if (empty($data)) {
    $message = sprintf('%s cannot be empty', $dataName);
    throw new $exceptionClass($message);
  }
}