Ejemplo n.º 1
0
 /**
  * Handle compile event.
  *
  * @param EncodeValueEvent $event The subscribed event.
  *
  * @return void
  */
 public function handleEncode(EncodeValueEvent $event)
 {
     $definition = $event->getValue();
     if (!$definition instanceof Definition) {
         return;
     }
     $type = $definition->getType();
     $method = 'encode' . $this->convertTypeToMethod($type);
     if (method_exists($this, $method)) {
         $buffer = $this->{$method}($definition, $event->getEncoder(), $event->getJsonFlags());
         if ($buffer) {
             $event->addLine($buffer);
             $this->handleMethodCalls($definition, $event->getEncoder(), $event);
         }
         $event->setSuccessful();
     }
 }