Checks if slug exist

@param Repo $repo
@return boolean
768172
public function isExists(Repo $repo)
    {
        $anotherRepo = $this->findBySlug($repo->getSlug());

        return ($anotherRepo != null && $repo->getId() != $anotherRepo->getId());
    }
1172842
public function hasRole($slug, $operator = null)
    {
        $operator = is_null($operator) ? $this->parseOperator($slug) : $operator;

        $roles = $this->getRoles();
        $roles = $roles instanceof \Illuminate\Contracts\Support\Arrayable ? $roles->toArray() : (array) $roles;
        $slug = $this->hasDelimiterToArray($slug);

        // array of slugs
        if ( is_array($slug) ) {

            if ( ! in_array($operator, ['and', 'or']) ) {
                $e = 'Invalid operator, available operators are "and", "or".';
                throw new \InvalidArgumentException($e);
            }

            $call = 'isWith' . ucwords($operator);

            return $this->$call($slug, $roles);
        }

        // single slug
        return in_array($slug, $roles);
    }
1106386
public function delete(Repo $repo)
    {
        $rows = array();

        foreach ($this->getRows() as $row) {
            if ($row['id'] == $repo->getId()) {
                continue;
            }
            $rows[] = $row;
        }

        file_put_contents($this->filename, Yaml::dump($rows));
    }
559419
protected function has_update( $slug ) {
		$update_list = get_site_transient( $this->upgrade_transient );

		return isset( $update_list->response[ $slug ] );
	}
518970
public function update(Repo $repo)
    {
        $repo = $this->_em->merge($repo);
        $this->_em->persist($repo);
        $this->_em->flush($repo);

        return $repo;
    }
1279551
protected function get_changelog_filename( $repo ) {
		$changelogs  = [ 'CHANGES.md', 'CHANGELOG.md', 'changes.md', 'changelog.md' ];
		$changes     = null;
		$local_files = null;

		if ( is_dir( $repo->local_path ) ) {
			$local_files = scandir( $repo->local_path, 0 );
		}

		$changes = array_intersect( (array) $local_files, $changelogs );
		$changes = array_pop( $changes );

		if ( ! empty( $changes ) ) {
			return $changes;
		}

		return false;
	}
16757
protected function loadRepo(Repo $repo = null)
    {
        if (null == $repo) {
            return null;
        }
        $this->loadExtraInfos($repo);
        $this->loadPackagistInfos($repo);

        return $repo;
    }
419485
public static function checkBySlug(string $slug)
    {
        if(Language::all()->where('slug', $slug)->count()) {
            return true;
        }
        return false;
    }
100109
public function get($account, $repo)
    {
        return $this->getClient()->setApiVersion('2.0')->get(
            sprintf('repositories/%s/%s', $account, $repo)
        );
    }
286283
public static function exists($sSlug): bool
    {
        $aModules = static::modules();

        foreach ($aModules as $oModule) {
            if ($sSlug === $oModule->slug) {
                return true;
            }
        }

        return false;
    }
967035
private function checkUpdatingSlug($slug)
    {
        if ($this->id >= 1) {
            // find entries matching slug, exclude updating entry
            $exist = self::where($this->slugOptions->slugField, $slug)
                ->where('id', '!=', $this->id)
                ->first();

            // no entries, save to use current slug
            if (!$exist) {
                return $slug;
            }
        }

        // unique slug needed
        return false;
    }
480968
public function update(Repo $repo)
    {
        $rows = array();

        foreach ($this->getRows() as $row) {
            if ($row['id'] == $repo->getId()) {
                $row = array(
                    'slug' => $repo->getSlug(),
                    'qualityBadgeHash' => $repo->getQualityBadgeHash(),
                    'coverageBadgeHash' => $repo->getCoverageBadgeHash(),
                    'type' => $repo->getType(),
                    'id' => $repo->getId()
                );
            }
            $rows[] = $row;
        }

        file_put_contents($this->filename, Yaml::dump($rows));
    }
329037
public function findBySlug($slug)
    {
        foreach ($this->findAll() as $repo) {
            if ($slug == $repo->getSlug()) {
                return $repo;
            }
        }

        return null;
    }
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;
  }
256451
private function checkUpdatingSlug($slug)
    {
        if ($this->id >= 1) {

            $found = false;
            foreach ($this->uniqueModels() as $class) {

                // find entries matching slug, exclude updating entry
                $builder = $this->eloqent($class)->where('slug', $slug);

                // same model - exlude check
                if ($class == self::class) {
                    $builder = $builder->where('id', '!=', $this->id);
                }

                // found same slug - break, need new slug
                if ($found = $builder->first()) {
                    break;
                }
            }

            // save to use current slug for update
            if ($found == false || $found == null) {
                return $slug;
            }
        }

        // new unique slug needed
        return false;
    }
568433
public function isPullRequestMerged($owner, $repo, $number)
	{
		$merged = false;

		try
		{
			$data = array();
			$this->client->request("/repos/$owner/$repo/pulls/$number/merge", 'GET', $data, 204, '');
			$merged = true;
		}
		catch ( GitHubClientException $e )
		{
		}

		return $merged;
	}
1151438
public function deleteAction(Repo $repo)
    {
        if ($repo) {
            $this->getManager()->delete($repo);
            $this->get('session')->getFlashBag()->add('success', 'Repository has been deleted successfully');
        } else {
            $this->get('session')->getFlashBag()->add('error', 'This repository does not exist');
        }

        return new RedirectResponse($this->generateUrl('snide_travinizer_dashboard'));
    }