/**
  * @param \App\Satis\Collections\RepositoryCollection $repositoryCollection
  * @param string $repositoryId
  * @param \Illuminate\Support\Collection $input
  * @return \App\Satis\Collections\RepositoryCollection
  * @throws \App\Satis\Exceptions\RepositoryNotFoundException
  */
 protected function _addOrUpdateRepository(RepositoryCollection $repositoryCollection, $repositoryId, Collection $input)
 {
     $repository = new Repository();
     $repository->setUrl($input->get('url'));
     $repository->setType($input->get('type', config('satis.default_repository_type')));
     if ($input->has('async_mode')) {
         $this->configBuilder->setAsyncMode(filter_var($input->get('async_mode'), FILTER_VALIDATE_BOOLEAN));
     }
     if ($input->has('disable_build')) {
         $this->setDisableBuild(filter_var($input->get('disable_build'), FILTER_VALIDATE_BOOLEAN));
     }
     if ($repositoryId !== null) {
         if ($repositoryCollection->has($repositoryId)) {
             $repositoryCollection->put($repositoryId, $repository);
         } else {
             throw new RepositoryNotFoundException('Repository with ID "' . $repositoryId . '" does not exist.');
         }
     } else {
         $repositoryId = static::nameToId($repository->getUrl());
         $repositoryCollection->put($repositoryId, $repository);
     }
     $buildContext = new PrivateRepository();
     $buildContext->setItemId($repositoryId)->setItemName($repository->getUrl());
     $this->configBuilder->setBuildContext($buildContext);
     return $repositoryCollection;
 }
 /**
  * @param string $config
  * @return string
  */
 public function getPublicMirror($config)
 {
     /** @var \App\Satis\Model\Config $publicConfig */
     $publicConfig = $this->serializer->deserialize($config, 'App\\Satis\\Model\\Config', 'json');
     $repository = new Repository();
     $repository->setType('composer');
     $repository->setUrl('https://packagist.org/');
     $homepage = $publicConfig->getHomepage();
     $publicConfig->setHomepage(rtrim($homepage, '/') . '/' . config('satis.public_repository'))->setRequireAll(false)->setRepositories(new RepositoryCollection([$repository]));
     return $this->serializer->serialize($publicConfig, 'json');
 }