/**
  * Build the rest adapter
  *
  * @return RestAdapter
  * @throws RetrofitException
  */
 public function build()
 {
     if (null === $this->baseUrl) {
         throw new RetrofitException('Could not build RestAdapter with null $baseUrl');
     }
     if (null === $this->serializer && null === $this->serializerAdapter) {
         $this->serializerAdapter = new JmsSerializerAdapter(SerializerBuilder::create()->build());
         $this->deserializerAdapter = $this->serializerAdapter;
     }
     if (null === $this->eventDispatcher) {
         $this->eventDispatcher = new EventDispatcher();
     }
     foreach ($this->subscribers as $subscriber) {
         $this->eventDispatcher->addSubscriber($subscriber);
     }
     if (null === $this->logger) {
         $this->logger = new NullLogger();
     }
     if ($this->useLogSubscriber) {
         $this->eventDispatcher->addSubscriber(new LogSubscriber($this->logger));
     }
     $client = $this->clientProvider->getClient();
     if ($client instanceof EventDispatcherAware) {
         $client->setEventDispatcher($this->eventDispatcher);
     }
     $adapter = new RestAdapter($this->baseUrl, $client, $this->eventDispatcher, $this->serializerAdapter, $this->deserializerAdapter);
     return $adapter;
 }
 /**
  * Build the rest adapter
  *
  * @return RestAdapter
  * @throws RetrofitException
  */
 public function build()
 {
     if (null === $this->baseUrl) {
         throw new RetrofitException('Could not build RestAdapter with null $baseUrl');
     }
     if (null === $this->serializer) {
         $this->serializer = SerializerBuilder::create()->build();
     }
     if (null === $this->eventDispatcher) {
         $this->eventDispatcher = new EventDispatcher();
     }
     $adapter = new RestAdapter($this->baseUrl, $this->clientProvider->getClient(), $this->serializer, $this->eventDispatcher);
     return $adapter;
 }