public function add(ClassInterface $import, $alias = NULL) {
    if (empty($alias)) {
      $alias = $import->getName();
    }

    if (empty($alias)) {
      throw new InvalidArgumentException('GClass: '.$import.' must have a valid FQN: '.$import->getFQN());
    }
    
    if (array_key_exists($lowerAlias = mb_strtolower($alias), $this->aliases)) {
      $usedBy = $this->classes[ $this->aliases[$lowerAlias] ];

      if (!$import->equals($usedBy)) {
        throw new LogicException('Alias: '.$alias.' is already used by Class '.$usedBy);
      }
    }
    
    $this->classes[$alias] = $import;
    $this->aliases[$lowerAlias] = $alias;
    return $this;
  }
public function add(ClassInterface $import, $alias = NULL) {
    if (empty($alias)) {
      $alias = $import->getName();
    }

    if (empty($alias)) {
      throw new InvalidArgumentException('GClass: '.$import.' must have a valid FQN: '.$import->getFQN());
    }
    
    if (array_key_exists($lowerAlias = mb_strtolower($alias), $this->aliases)) {
      $usedBy = $this->classes[ $this->aliases[$lowerAlias] ];

      if (!$import->equals($usedBy)) {
        throw new LogicException('Alias: '.$alias.' is already used by Class '.$usedBy);
      }
    }
    
    $this->classes[$alias] = $import;
    $this->aliases[$lowerAlias] = $alias;
    return $this;
  }
public function add ( ClassInterface $ import , $ alias = NULL ) { if ( empty ( $ alias ) ) { $ alias = $ import -> getName ( ) ; } if ( empty ( $ alias ) ) { throw new InvalidArgumentException ( 'GClass: ' . $ import . ' must have a valid FQN: ' . $ import -> getFQN ( ) ) ; } if ( array_key_exists ( $ lowerAlias = mb_strtolower ( $ alias ) , $ this -> aliases ) ) { $ usedBy = $ this -> classes [ $ this -> aliases [ $ lowerAlias ] ] ; if ( ! $ import -> equals ( $ usedBy ) ) { throw new LogicException ( 'Alias: ' . $ alias . ' is already used by Class ' . $ usedBy ) ; } } $ this -> classes [ $ alias ] = $ import ; $ this -> aliases [ $ lowerAlias ] = $ alias ; return $ this ; }
Adds an Import

its not allowed to set an already used alias.
You have to remove the alias first
@param string $alias sets an explicit alias. (the implicit is always the classname)
Adds an Import