@param SerializerInterface|null $serializer

@return SerializerInterface
1670
protected static function prepareSerializer(SerializerInterface $serializer = null)
    {
        if (null === $serializer) {
            $serializer = SerializerFactory::create();
        }

        return $serializer;
    }
955613
public function getSerialyser() {
       $serialyser = $this->getServiceLocator()->get($this->serialyserList[$this->driverName]);
       $serialyser->setServiceLocator($this->serviceLocator)->setDriverEscaper($this->driverEscaper)->setOptions($this->options)->prefixQuery();
       return $serialyser;
    }
1021228
public static function create($name)
    {
        $serializerClass = 'Dmishh\\SettingsBundle\\Serializer\\' . Container::camelize($name) . 'Serializer';

        if (class_exists($serializerClass)) {
            return new $serializerClass();
        } else {
            $serializerClass = $name;

            if (class_exists($serializerClass)) {
                $serializer = new $serializerClass();
                if ($serializer instanceof SerializerInterface) {
                    return $serializer;
                }
            }
        }

        throw new UnknownSerializerException($serializerClass);
    }
858352
public static function serialize(Serializer $serializer, SplFixedArray $splFixedArray)
    {
        $toArray = [
            Serializer::CLASS_IDENTIFIER_KEY => get_class($splFixedArray),
            Serializer::CLASS_PARENT_KEY => 'SplFixedArray',
            Serializer::SCALAR_VALUE => [],
        ];
        foreach ($splFixedArray->toArray() as $key => $field) {
            $toArray[Serializer::SCALAR_VALUE][$key] = $serializer->serialize($field);
        }

        return $toArray;
    }
1352162
def _resolve_serializer(self, serializer):
        
        if isinstance(serializer, Serializer):
            return serializer

        if serializer in self._serializers:
            return self._serializers[serializer]

        raise RuntimeError('Unsupported serializer')
1020704
@Override
  public <T> Serializer<T> nullable(Serializer<T> serializer) {
    return new NullSerializer<T>(serializer);
  }
1118476
protected function setSerializerClass(string $serializerClass): self
    {
        assert(
            class_exists($serializerClass) === true &&
            in_array(JsonApiDataRulesSerializerInterface::class, class_implements($serializerClass)) === true
        );

        $this->serializerClass = $serializerClass;

        return $this;
    }
1306521
public UserManagedCacheBuilder<K, V, T> withKeySerializer(Serializer<K> keySerializer) {
    if (keySerializer == null) {
      throw new NullPointerException("Null key serializer");
    }
    UserManagedCacheBuilder<K, V, T> otherBuilder = new UserManagedCacheBuilder<>(this);
    otherBuilder.keySerializer = keySerializer;
    return otherBuilder;
  }
1256890
public static function serialize(Serializer $serializer, DateTimeZone $dateTimeZone)
    {
        return array(
            Serializer::CLASS_IDENTIFIER_KEY => 'DateTimeZone',
            'timezone' => array(
                Serializer::SCALAR_TYPE => 'string',
                Serializer::SCALAR_VALUE => $dateTimeZone->getName(),
            ),
        );
    }
21422
public static function unserialize(Serializer $serializer, $className, array $value)
    {
        $ref = new ReflectionClass($className);

        return self::fillObjectProperties(self::getTypedValue($serializer, $value), $ref);
    }
811639
public function getSerilizer()
    {
        if (!$this->_serializer instanceof AnDomainSerializerAbstract) {
            if (!$this->_serializer instanceof AnServiceIdentifier) {
                $this->setSerializer($this->_serializer);
            }

            $this->_serializer = $this->getService($this->_serializer);
        }

        return $this->_serializer;
    }
163988
public function getObjectMapping(string $class): NormalizationObjectMappingInterface
    {
        $reflectionClass = new \ReflectionClass($class);

        if (in_array('Doctrine\Common\Persistence\Proxy', $reflectionClass->getInterfaceNames(), true)) {
            $class = $reflectionClass->getParentClass()->name;
        }

        if (isset($this->objectMappings[$class])) {
            return $this->objectMappings[$class];
        }

        throw SerializerLogicException::createMissingMapping($class);
    }
757004
private function add(JWESerializer $serializer): self
    {
        $this->serializers[$serializer->name()] = $serializer;

        return $this;
    }
480901
private function unserializeResponse($serialized, MessageFactoryInterface $messageFactory)
    {
        return $this->createResponse($this->unserialize($serialized), $messageFactory);
    }
858066
public function setSerializer($serializer)
    {
        if (!$serializer instanceof AnDomainSerializerAbstract) {
            if (is_string($serializer) && strpos($serializer, '.') === false) {
                $identifier = clone $this->_repository->getIdentifier();
                $identifier->path = array('domain','serializer');
                $identifier->name = $serializer;
                register_default(array(
                    'identifier' => $identifier, 
                    'prefix' => $this->_repository->getClone()
                ));
            } else {
                $identifier = $this->getIdentifier($serializer);
            }

            $serializer = $identifier;
        }

        $this->_serializer = $serializer;
    }
1087740
protected function getSerializer()
    {
        if (is_null($this->serializer)) {
            if (!class_exists('\JMS\Serializer\SerializerBuilder')) {
                throw new SerializerNotFoundException();
            }

            $this->serializer = \JMS\Serializer\SerializerBuilder::create()
                ->addMetadataDir(__DIR__.'/../Resources/serializer/', 'Ladybug\\Type')
                ->build();
        }

        return $this->serializer;
    }
466065
public static function create(string $format = SerializerBuilder::DEFAULT_FORMAT) : SerializerInterface
    {
        return SerializerBuilder::instance()->setFormat($format)->build();
    }