/**
  * @param $object
  * @throws SerializationException
  * @return array
  */
 public function serialize($object)
 {
     return $this->serializer->serialize($object);
 }
 /**
  * @param NamedCommand $command
  * @return string
  */
 public function serialize(NamedCommand $command)
 {
     return json_encode($this->serializer->serialize($command));
 }
Пример #3
0
 /**
  * @test
  */
 public function itShouldThrowAnExceptionWhenTryingToSerializeAPrimitive()
 {
     $serializer = new Serializer($this->classMapper, $this->hydratorFactory, $this->dataFormatter, $this->instantiator);
     $this->setExpectedException(\InvalidArgumentException::class);
     $serializer->serialize('a');
 }