public function remove($targetName)
    {
        if (InstallTarget::DEFAULT_TARGET === $targetName && $this->defaultTarget) {
            $targetName = $this->defaultTarget->getName();
        }

        unset($this->targets[$targetName]);

        if ($this->defaultTarget && $targetName === $this->defaultTarget->getName()) {
            $this->defaultTarget = $this->targets ? reset($this->targets) : null;
        }
    }