/**
  * Transform an elastica document to a resource.
  *
  * @param Document $document
  *
  * @return Resource|null
  */
 public function reverseTransform(Document $document)
 {
     if ($document) {
         $uri = $document->getParam('_id');
         $type = $document->getParam('_type');
         $graph = $this->serializerHelper->getGraph($document->getParam('_index'), $uri, $type);
         $phpClass = $this->typeMapperRegistry->get($type);
         if ($phpClass) {
             return new $phpClass($uri, $graph);
         }
         return new Resource($uri, $graph);
     }
     return;
 }