original_string: private function hydrateEntity($document)
      {
          $class = $this->entityClass;
          $reflectionClass = new \ReflectionClass(AbstractDocument::class);
          $entity = new $class();
  
          if (!($entity instanceof AbstractDocument)) {
              throw new \Exception(sprintf('"%s" is not a subclass of "%s"', $this->entityClass, AbstractDocument::class));
          }
  
          $documentProperty = $reflectionClass->getProperty('document');
          $documentProperty->setAccessible(true);
          $documentProperty->setValue($entity, $document);
  
          return $entity;
      }
code: private function hydrateEntity($document)
      {
          $class = $this->entityClass;
          $reflectionClass = new \ReflectionClass(AbstractDocument::class);
          $entity = new $class();
  
          if (!($entity instanceof AbstractDocument)) {
              throw new \Exception(sprintf('"%s" is not a subclass of "%s"', $this->entityClass, AbstractDocument::class));
          }
  
          $documentProperty = $reflectionClass->getProperty('document');
          $documentProperty->setAccessible(true);
          $documentProperty->setValue($entity, $document);
  
          return $entity;
      }
code_tokens: private function hydrateEntity ( $ document ) { $ class = $ this -> entityClass ; $ reflectionClass = new \ ReflectionClass ( AbstractDocument :: class ) ; $ entity = new $ class ( ) ; if ( ! ( $ entity instanceof AbstractDocument ) ) { throw new \ Exception ( sprintf ( '"%s" is not a subclass of "%s"' , $ this -> entityClass , AbstractDocument :: class ) ) ; } $ documentProperty = $ reflectionClass -> getProperty ( 'document' ) ; $ documentProperty -> setAccessible ( true ) ; $ documentProperty -> setValue ( $ entity , $ document ) ; return $ entity ; }
docstring: Hydrates a document entity with a mongo document
  
  @param mixed $document
  
  @return AbstractDocument
  
  @throws \Exception
docstring_tokens: Hydrates a document entity with a mongo document