original_string: public function getRepository($documentClass)
      {
          if (!isset($this->repositories[$documentClass])) {
              if (!$this->metadataFactory->hasClass($documentClass) || !$this->metadataFactory->isDocumentClass($documentClass)) {
                  throw new \InvalidArgumentException(sprintf('The class "%s" is not a valid document class.', $documentClass));
              }
  
              $repositoryClass = $documentClass.'Repository';
              if (!class_exists($repositoryClass)) {
                  throw new \RuntimeException(sprintf('The class "%s" does not exists.', $repositoryClass));
              }
  
              $this->repositories[$documentClass] = new $repositoryClass($this);
          }
  
          return $this->repositories[$documentClass];
      }
code: public function getRepository($documentClass)
      {
          if (!isset($this->repositories[$documentClass])) {
              if (!$this->metadataFactory->hasClass($documentClass) || !$this->metadataFactory->isDocumentClass($documentClass)) {
                  throw new \InvalidArgumentException(sprintf('The class "%s" is not a valid document class.', $documentClass));
              }
  
              $repositoryClass = $documentClass.'Repository';
              if (!class_exists($repositoryClass)) {
                  throw new \RuntimeException(sprintf('The class "%s" does not exists.', $repositoryClass));
              }
  
              $this->repositories[$documentClass] = new $repositoryClass($this);
          }
  
          return $this->repositories[$documentClass];
      }
code_tokens: public function getRepository ( $ documentClass ) { if ( ! isset ( $ this -> repositories [ $ documentClass ] ) ) { if ( ! $ this -> metadataFactory -> hasClass ( $ documentClass ) || ! $ this -> metadataFactory -> isDocumentClass ( $ documentClass ) ) { throw new \ InvalidArgumentException ( sprintf ( 'The class "%s" is not a valid document class.' , $ documentClass ) ) ; } $ repositoryClass = $ documentClass . 'Repository' ; if ( ! class_exists ( $ repositoryClass ) ) { throw new \ RuntimeException ( sprintf ( 'The class "%s" does not exists.' , $ repositoryClass ) ) ; } $ this -> repositories [ $ documentClass ] = new $ repositoryClass ( $ this ) ; } return $ this -> repositories [ $ documentClass ] ; }
docstring: Returns repositories by document class.
  
  @param string $documentClass The document class.
  
  @return \Mandango\Repository The repository.
  
  @throws \InvalidArgumentException If the document class is not a valid document class.
  @throws \RuntimeException         If the repository class build does not exist.
  
  @api
docstring_tokens: Returns repositories by document class .