You are here

public function SerializableStrategy::setSerializer in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/zendframework/zend-hydrator/src/Strategy/SerializableStrategy.php \Zend\Hydrator\Strategy\SerializableStrategy::setSerializer()

Set serializer

Parameters

string|SerializerAdapter $serializer:

Return value

SerializableStrategy

2 calls to SerializableStrategy::setSerializer()
SerializableStrategy::getSerializer in vendor/zendframework/zend-hydrator/src/Strategy/SerializableStrategy.php
Get serializer
SerializableStrategy::__construct in vendor/zendframework/zend-hydrator/src/Strategy/SerializableStrategy.php

File

vendor/zendframework/zend-hydrator/src/Strategy/SerializableStrategy.php, line 71

Class

SerializableStrategy

Namespace

Zend\Hydrator\Strategy

Code

public function setSerializer($serializer) {
  if (!is_string($serializer) && !$serializer instanceof SerializerAdapter) {
    throw new InvalidArgumentException(sprintf('%s expects either a string serializer name or Zend\\Serializer\\Adapter\\AdapterInterface instance; ' . 'received "%s"', __METHOD__, is_object($serializer) ? get_class($serializer) : gettype($serializer)));
  }
  $this->serializer = $serializer;
  return $this;
}