trait NullGuardTrait in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/zendframework/zend-stdlib/src/Guard/NullGuardTrait.php \Zend\Stdlib\Guard\NullGuardTrait
Provide a guard method against null data
Hierarchy
- trait \Zend\Stdlib\Guard\NullGuardTrait
File
- vendor/
zendframework/ zend-stdlib/ src/ Guard/ NullGuardTrait.php, line 15
Namespace
Zend\Stdlib\GuardView source
trait NullGuardTrait {
/**
* Verify that the data is not null
*
* @param mixed $data the data to verify
* @param string $dataName the data name
* @param string $exceptionClass FQCN for the exception
* @throws \Exception
*/
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);
}
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
NullGuardTrait:: |
protected | function | Verify that the data is not null |