original_string: public function add($alias, $id)
      {
          if (isset($this->aliases[$alias])) {
              if ($this->aliases[$alias] === $id) {
                  // exactly the same alias for the specified item is already exists
                  return $this;
              }
  
              throw new Exception\AliasAlreadyExistsException(
                  sprintf(
                      'The "%s" sting cannot be used as an alias for "%s" item'
                      . ' because it is already used for "%s" item.',
                      $alias,
                      $id,
                      $this->aliases[$alias]
                  )
              );
          }
  
          $this->aliases[$alias] = $id;
  
          $id               = $this->getId($alias);
          $this->ids[$id][] = $alias;
  
          return $this;
      }
code: public function add($alias, $id)
      {
          if (isset($this->aliases[$alias])) {
              if ($this->aliases[$alias] === $id) {
                  // exactly the same alias for the specified item is already exists
                  return $this;
              }
  
              throw new Exception\AliasAlreadyExistsException(
                  sprintf(
                      'The "%s" sting cannot be used as an alias for "%s" item'
                      . ' because it is already used for "%s" item.',
                      $alias,
                      $id,
                      $this->aliases[$alias]
                  )
              );
          }
  
          $this->aliases[$alias] = $id;
  
          $id               = $this->getId($alias);
          $this->ids[$id][] = $alias;
  
          return $this;
      }
code_tokens: public function add ( $ alias , $ id ) { if ( isset ( $ this -> aliases [ $ alias ] ) ) { if ( $ this -> aliases [ $ alias ] === $ id ) { // exactly the same alias for the specified item is already exists return $ this ; } throw new Exception \ AliasAlreadyExistsException ( sprintf ( 'The "%s" sting cannot be used as an alias for "%s" item' . ' because it is already used for "%s" item.' , $ alias , $ id , $ this -> aliases [ $ alias ] ) ) ; } $ this -> aliases [ $ alias ] = $ id ; $ id = $ this -> getId ( $ alias ) ; $ this -> ids [ $ id ] [ ] = $ alias ; return $ this ; }
docstring: Registers an alias for the specified identifier
  
  @param string $alias A string that can be used as an alias for the item id
  @param string $id    The item identifier or already registered item alias
  
  @return self
  
  @throws Exception\AliasAlreadyExistsException if the alias is used for another item
docstring_tokens: Registers an alias for the specified identifier