original_string: public function registerRepository(ManagedRepositoryInterface $repository) {
  		$name = $repository->getName();
  		if($this->hasRepository($name)) {
  			throw new \LogicException(sprintf('Repository %s is already registered.', $name));
  		}
  
  		$event = new ManagedRepositoryEvent($repository);
  		$this->eventDispatcher->dispatch(ManagedRepositoryEvent::REGISTER, $event);
  		$repository = $event->getRepository();
  
  		$this->repositories[$name] = $repository;
  		$this->classMap[$repository->getClassName()] = $name;
  		return $repository;
  	}
code: public function registerRepository(ManagedRepositoryInterface $repository) {
  		$name = $repository->getName();
  		if($this->hasRepository($name)) {
  			throw new \LogicException(sprintf('Repository %s is already registered.', $name));
  		}
  
  		$event = new ManagedRepositoryEvent($repository);
  		$this->eventDispatcher->dispatch(ManagedRepositoryEvent::REGISTER, $event);
  		$repository = $event->getRepository();
  
  		$this->repositories[$name] = $repository;
  		$this->classMap[$repository->getClassName()] = $name;
  		return $repository;
  	}
code_tokens: public function registerRepository ( ManagedRepositoryInterface $ repository ) { $ name = $ repository -> getName ( ) ; if ( $ this -> hasRepository ( $ name ) ) { throw new \ LogicException ( sprintf ( 'Repository %s is already registered.' , $ name ) ) ; } $ event = new ManagedRepositoryEvent ( $ repository ) ; $ this -> eventDispatcher -> dispatch ( ManagedRepositoryEvent :: REGISTER , $ event ) ; $ repository = $ event -> getRepository ( ) ; $ this -> repositories [ $ name ] = $ repository ; $ this -> classMap [ $ repository -> getClassName ( ) ] = $ name ; return $ repository ; }
docstring: Register a repository
  
  @param ManagedRepositoryInterface $repository
  @return $this
  @throws \LogicException
docstring_tokens: Register a repository