You are here

protected function EmptyGuardTrait::guardAgainstEmpty in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/zendframework/zend-stdlib/src/Guard/EmptyGuardTrait.php \Zend\Stdlib\Guard\EmptyGuardTrait::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/EmptyGuardTrait.php, line 25

Class

EmptyGuardTrait
Provide a guard method against empty data

Namespace

Zend\Stdlib\Guard

Code

protected function guardAgainstEmpty($data, $dataName = 'Argument', $exceptionClass = 'Zend\\Stdlib\\Exception\\InvalidArgumentException') {
  if (empty($data)) {
    $message = sprintf('%s cannot be empty', $dataName);
    throw new $exceptionClass($message);
  }
}