public function GetSetMethodNormalizer::setCallbacks

Set normalization callbacks

Parameters

array $callbacks help normalize the result:

Throws

InvalidArgumentException if a non-callable callback is set

File

drupal/core/vendor/symfony/serializer/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php, line 50

Class

GetSetMethodNormalizer
Converts between objects with getter and setter methods and arrays.

Namespace

Symfony\Component\Serializer\Normalizer

Code

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;
}