public function BooleanStrategy::extract in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/zendframework/zend-hydrator/src/Strategy/BooleanStrategy.php \Zend\Hydrator\Strategy\BooleanStrategy::extract()
Converts the given value so that it can be extracted by the hydrator.
Parameters
bool $value The original value.:
Return value
int|string Returns the value that should be extracted.
Throws
Overrides StrategyInterface::extract
File
- vendor/
zendframework/ zend-hydrator/ src/ Strategy/ BooleanStrategy.php, line 61
Class
- BooleanStrategy
- This Strategy extracts and hydrates int and string values to Boolean values
Namespace
Zend\Hydrator\StrategyCode
public function extract($value) {
if (!is_bool($value)) {
throw new InvalidArgumentException(sprintf('Unable to extract. Expected bool. %s was given.', is_object($value) ? get_class($value) : gettype($value)));
}
return $value === true ? $this->trueValue : $this->falseValue;
}