Edit repository  action

@param \Snide\Bundle\TravinizerBundle\Model\Repo $repo
@return array|RedirectResponse

@ParamConverter("repo", converter="snide_travinizer.repo_converter", class="Snide\Bundle\TravinizerBundle\Model\Repo")
@Template
548548
public function editAction(Repo $repo = null)
    {
        if (!$repo) {
            return new RedirectResponse($this->generateUrl('snide_travinizer_dashboard'));
        }
        $form = $this->getForm($repo);
        return array(
            'form' => $form->createView(),
            'repo' => $repo,
            'slug' => $repo->getSlug(),
            'errors' => array()
        );
    }
589572
public function urlForRepository(string $user, string $repo): string
    {
        $key = sprintf(self::CACHE_KEY_TEMPLATE, md5($user . $repo), 'repo_url');

        if (($latest = $this->getFromCache($key)) !== null) {
            return $latest;
        }

        $api = $this->client->api('repo');
        $params = [$user, $repo];

        $repo = $this->callGitHub([$api, 'show'], $params);

        $url = $repo['html_url'] ?? '';

        $this->setToCache($key, $url, 30);
        return $url;
    }
730251
public function create(Repo $repo)
    {
        $rows = $this->getRows();
        $id = sizeof($rows) + 1;

        $rows[] = array(
            'id' => $id,
            'slug' => $repo->getSlug(),
            'type' => $repo->getType(),
            'qualityBadgeHash' => $repo->getQualityBadgeHash(),
            'coverageBadgeHash' => $repo->getCoverageBadgeHash(),
        );

        file_put_contents($this->filename, Yaml::dump($rows));
    }
720333
public function removeComposerRepository($repo_url) {
    $composer_json = $this->getComposerJson();
    if (!empty($composer_json['repositories'])) {
      foreach ($composer_json['repositories'] as $key => $repo) {
        $url = $repo['url'];
        if ($repo_url == $url) {
          unset($composer_json['repositories'][$key]);
          $this->writeComposerJson($composer_json);

          return TRUE;
        }
      }
    }
    return FALSE;
  }
158974
public function get_remote_repo_meta( $repo ) {
		$file = 'style.css';
		if ( false !== stripos( $repo->type, 'plugin' ) ) {
			$file = basename( $repo->file );
		}

		$repo_api = Singleton::get_instance( 'API', $this )->get_repo_api( $repo->git, $repo );
		if ( null === $repo_api ) {
			return false;
		}

		$this->{$repo->type} = $repo;
		$this->set_defaults( $repo->type );

		if ( $repo_api->get_remote_info( $file ) ) {
			if ( ! self::is_wp_cli() ) {
				if ( ! apply_filters( 'github_updater_run_at_scale', false ) ) {
					$repo_api->get_repo_meta();
					$changelog = $this->get_changelog_filename( $repo );
					if ( $changelog ) {
						$repo_api->get_remote_changes( $changelog );
					}
					$repo_api->get_remote_readme();
				}
				if ( ! empty( self::$options['branch_switch'] ) ) {
					$repo_api->get_remote_branches();
				}
			}
			$repo_api->get_remote_tag();
			$repo->download_link = $repo_api->construct_download_link();
			$language_pack       = new Language_Pack( $repo, new Language_Pack_API( $repo ) );
			$language_pack->run();
		}

		$this->remove_hooks( $repo_api );

		return true;
	}
235149
public function show(string $repo, array $params = [])
    {
        $path = $this->buildUsersPath($repo);

        return $this->get($path, $params);
    }
1161323
public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
    {
        $res = parent::uninstall($repo, $package);
        $this->operations[] = array('-', $package);
        return $res;
    }
1370747
public function delete($account, $repo, $linkID)
    {
        return $this->requestDelete(
            sprintf('repositories/%s/%s/links/%d', $account, $repo, $linkID)
        );
    }
1336892
public static function checkRepositoryAccess(Repository $repository = null, $edit = false): void
    {
        if ($repository === null) {
            throw new RepositoryNotFoundException();
        }

        if (!$repository->canShow()) {
            throw new RepositoryAccessDeniedException();
        }

        if ($edit && !$repository->canEdit()) {
            throw new RepositoryAccessDeniedException();
        }
    }
698208
public function validate($repo, Constraint $constraint)
    {
        if($this->repoManager->isExists($repo)) {
            $this->context->addViolation($constraint->message, array('string' => $repo->getSlug()));
        }
    }
1220374
protected function deleteRecord(Repository $repo, Content $entity)
    {
        $recordId = $entity->getId();
        /** @var Mapping\ContentType $contentType */
        $contentType = $entity->getContenttype();
        $contentTypeName = (string) $contentType;
        if (!$this->users->isAllowed("contenttype:$contentTypeName:delete:$recordId")) {
            $this->loggerFlash->error(Trans::__('general.access-denied.content-not-modified', ['%title%' => $entity->getTitle()]));

            return false;
        }
        $result = $repo->delete($entity);
        if ($result) {
            $this->loggerSystem->info(sprintf('Deleted %s: %s', $contentType['singular_name'], $entity->getTitle()), ['event' => 'content']);
            $fieldRepo = $this->em->getRepository(FieldValue::class);
            $deleteFieldQuery = $fieldRepo->createQueryBuilder()
                ->delete($fieldRepo->getTableName())
                ->where('content_id = :content_id')
                ->andWhere('contenttype= :contenttype')
                ->setParameter('content_id', $recordId)
                ->setParameter('contenttype', $contentTypeName);
            $deleteFieldQuery->execute();
        }

        return $result;
    }
1092454
public function override_dot_org( $type, $repo ) {
		// Correctly account for dashicon in Settings page.
		$icon           = is_array( $repo );
		$repo           = is_array( $repo ) ? (object) $repo : $repo;
		$dot_org_master = ! $icon ? $repo->dot_org && 'master' === $repo->branch : true;

		$transient_key = 'plugin' === $type ? $repo->file : null;
		$transient_key = 'theme' === $type ? $repo->slug : $transient_key;

		/**
		 * Filter update to override dot org.
		 *
		 * @since 8.5.0
		 *
		 * @return bool
		 */
		$override = in_array( $transient_key, apply_filters( 'github_updater_override_dot_org', [] ), true );

		return ! $dot_org_master || $override || $this->deprecate_override_constant();
	}
451165
public function repoGetFileInfo($repo, $path, $ref = null)
    {
        $src = $this->client->api('Repositories\Src');
        /** @var \Buzz\Message\Response $response */
        $response = $this->checkResponse($src->get($this->username, $repo, $ref, $path));

        return $this->cleanSrcData(json_decode($response->getContent(), true));
    }
1133967
public function install(InstalledRepositoryInterface $repo, PackageInterface $package) {
        parent::install($repo, $package);
        $instructions = $this->getInstructions($package);
        if (!$instructions || empty($instructions['install'])) { return; }
        $this->handleInstructions($package, $instructions['install']);
    }
1258835
public function set_branch_on_switch( $repo ) {
		$this->cache = $this->get_repo_cache( $repo );

		if ( isset( $_GET['action'], $_GET['rollback'], $this->cache['branches'] ) &&
			( 'upgrade-plugin' === $_GET['action'] || 'upgrade-theme' === $_GET['action'] )
		) {
			$current_branch = array_key_exists( $_GET['rollback'], $this->cache['branches'] )
				? $_GET['rollback']
				: 'master';

			$this->set_repo_cache( 'current_branch', $current_branch, $repo );
			self::$options[ 'current_branch_' . $repo ] = $current_branch;
			update_site_option( 'github_updater', self::$options );
		}
	}
81608
def edit!(**kwords)
      response = connection.send(:put,
                                 "/repos/#{self.Name}",
                                 body: JSON.generate(kwords))
      hash = JSON.parse(response.body, symbolize_names: true)
      return nil if hash == marshal_dump
      marshal_load(hash)
      self
    end
324244
def hook_action(action, repo_id):
    """"""
    github = GitHubAPI(user_id=current_user.id)
    repos = github.account.extra_data['repos']

    if repo_id not in repos:
        abort(404)

    if action == 'disable':
        if github.remove_hook(repo_id, repos[repo_id]['full_name']):
            db.session.commit()
            return redirect(url_for('.index'))
        else:
            abort(400)
    elif action == 'enable':
        if github.create_hook(repo_id, repos[repo_id]['full_name']):
            db.session.commit()
            return redirect(url_for('.index'))
        else:
            abort(400)
    else:
        abort(400)