public function addRepositories(array $repositories)
    {
        foreach ($repositories as $index => $repo) {
            $this->validateRepositories($index, $repo);

            if ('package' === $repo['type']) {
                $name = $repo['package']['name'];
            } else {
                $name = \is_int($index) ? preg_replace('{^https?://}i', '', $repo['url']) : $index;
                $name = isset($repo['name']) ? $repo['name'] : $name;
                $repo['asset-repository-manager'] = $this;
                $repo['vcs-package-filter'] = $this->packageFilter;
            }

            $repoInstance = Util::addRepository($this->io, $this->rm, $this->repositories, $name, $repo, $this->pool);

            if (null === $this->pool && $repoInstance instanceof RepositoryInterface) {
                $this->poolRepositories[] = $repoInstance;
            }
        }
    }