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