public function AbstractNormalizer::setCallbacks in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/serializer/Normalizer/AbstractNormalizer.php \Symfony\Component\Serializer\Normalizer\AbstractNormalizer::setCallbacks()
Set normalization callbacks.
Parameters
callable[] $callbacks help normalize the result:
Return value
self
Throws
InvalidArgumentException if a non-callable callback is set
File
- vendor/
symfony/ serializer/ Normalizer/ AbstractNormalizer.php, line 114
Class
- AbstractNormalizer
- Normalizer implementation.
Namespace
Symfony\Component\Serializer\NormalizerCode
public function setCallbacks(array $callbacks) {
foreach ($callbacks as $attribute => $callback) {
if (!is_callable($callback)) {
throw new InvalidArgumentException(sprintf('The given callback for attribute "%s" is not callable.', $attribute));
}
}
$this->callbacks = $callbacks;
return $this;
}