original_string: public function addIndexMetadata($contextName, IndexMetadata $indexMetadata)
      {
          if (isset($this->indexMetadatas[$contextName])) {
              throw new \InvalidArgumentException(sprintf(
                  'Context name "%s" has already been registered',
                  $contextName
              ));
          }
  
          $indexMetadata->setName($this->name);
          $indexMetadata->setClassMetadata($this);
          $this->indexMetadatas[$contextName] = $indexMetadata;
      }
code: public function addIndexMetadata($contextName, IndexMetadata $indexMetadata)
      {
          if (isset($this->indexMetadatas[$contextName])) {
              throw new \InvalidArgumentException(sprintf(
                  'Context name "%s" has already been registered',
                  $contextName
              ));
          }
  
          $indexMetadata->setName($this->name);
          $indexMetadata->setClassMetadata($this);
          $this->indexMetadatas[$contextName] = $indexMetadata;
      }
code_tokens: public function addIndexMetadata ( $ contextName , IndexMetadata $ indexMetadata ) { if ( isset ( $ this -> indexMetadatas [ $ contextName ] ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Context name "%s" has already been registered' , $ contextName ) ) ; } $ indexMetadata -> setName ( $ this -> name ) ; $ indexMetadata -> setClassMetadata ( $ this ) ; $ this -> indexMetadatas [ $ contextName ] = $ indexMetadata ; }
docstring: Add an index metadata for the given context name.
  
  @param mixed $contextName
  @param IndexMetadata $indexMetadata
docstring_tokens: Add an index metadata for the given context name .