You are here

protected function NullGuardTrait::guardAgainstNull in Zircon Profile 8.0

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

Verify that the data is not null

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/NullGuardTrait.php, line 25

Class

NullGuardTrait
Provide a guard method against null data

Namespace

Zend\Stdlib\Guard

Code

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