/**
  * @param WebSocketEvent $webSocketEvent
  *
  * @return AbstractJsonEvent
  *
  * @throws \RuntimeException
  */
 private function resolveJsonEvent(WebSocketEvent $webSocketEvent)
 {
     if ($webSocketEvent->type !== TextEventInterface::EVENT_TYPE) {
         throw new \RuntimeException(sprintf('Cannot parse event with type "%s". Expected type is "%s"', $webSocketEvent->type, TextEventInterface::EVENT_TYPE));
     }
     $eventName = $this->parser->getEventName($webSocketEvent);
     $className = sprintf('%s\\%s', $this->baseNamespace, $this->getClassByEventName($eventName));
     if (class_exists($className)) {
         $event = new $className($webSocketEvent->type, $webSocketEvent->content);
         $deSerialized = $this->serializer->deserialize($event);
         return $deSerialized;
     }
     throw new \RuntimeException(sprintf('Class "%s" not exists', $className));
 }
 /**
  * @covers \Gamma\Pushpin\PushpinBundle\Services\Events\Json\EventSerializer::deserialize()
  */
 public function testDeserialize()
 {
     $event = new SimpleJsonEvent('TEXT', 'testAction:{
             "string":"test string",
             "bool":true,
             "int":150,
             "float":150.9999,
             "array": {
                 "key":"value"
             }
         }');
     static::assertEquals('testAction', $event->getName());
     $deSerialized = self::$instance->deserialize($event);
     static::assertInstanceOf('Gamma\\Pushpin\\PushpinBundle\\Tests\\Utils\\Events\\SimpleJsonEvent', $deSerialized);
     static::assertEquals('test string', $deSerialized->string);
     static::assertEquals(true, $deSerialized->bool);
     static::assertEquals(150, $deSerialized->int);
     static::assertEquals(150.9999, $deSerialized->float);
     static::assertEquals(['key' => 'value'], $deSerialized->array);
 }