@param VersionControlProvider $vcs

@return VCSClientInterface|null
499351
public function authenticate(VersionControlProvider $vcs): ?VCSClientInterface
    {
        $adapter = $this->adapters[$vcs->type()] ?? null;
        if (!$adapter) {
            $this->addError(self::ERR_VCS_MISCONFIGURED);
            return null;
        }

        $client = $adapter->buildClient($vcs);

        if ($client instanceof VCSClientInterface) {
            return $client;
        }

        $this->importErrors($adapter->errors());
        return null;
    }
321688
public function detectVersion(string $useragent): VersionInterface
    {
        $doMatch = preg_match(
            '/Screaming Frog SEO Spider\/\d+,\d/',
            $useragent
        );

        if ($doMatch) {
            $useragent = str_replace(',', '.', $useragent);
        }

        return (new VersionFactory())->detectVersion($useragent, ['Screaming Frog SEO Spider']);
    }
347440
public function projectVersion($opts = ['format' => 'table', 'fields' => ''])
    {
        $result = $this->taskDotenvReload()->run();

        $envVersion = getenv('GIT_BRANCH');
        if (!empty($envVersion)) {
            return new PropertyList(['version' => $envVersion]);
        }

        $result = $this->taskGitHash()->run();
        if ($result->wasSuccessful()) {
            return new PropertyList(['version' => $result->getData()['data'][0]['message'] ]);
        }

        return new PropertyList(['version' => 'Unknown']);
    }
721130
public function getVersions(VersionableInterface $resource)
    {
        $query = $this->_em->createQuery(
            'SELECT v FROM ResourceVersion v INDEX BY v.version '.
            'WHERE v.resourceName = ?1 AND v.resourceId = ?2 ORDER BY v.version DESC');
        $query->setParameter(1, get_class($resource));
        $query->setParameter(2, $resource->getResourceId());

        return $query->getResult();
    }
1015775
public function withProtocolVersions(array $versions): self {
        $versions = \array_unique($versions);

        if (empty($versions)) {
            throw new \Error("Empty array of protocol versions provided, must not be empty.");
        }

        foreach ($versions as $version) {
            if (!\in_array($version, ["1.0", "1.1", "2.0"], true)) {
                throw new \Error(
                    "Invalid HTTP protocol version: " . $version
                );
            }
        }

        if ($this->protocolVersions === $versions) {
            return $this;
        }

        $clone = clone $this;
        $clone->protocolVersions = $versions;

        return $clone;
    }
806976
public function setVersion($v)
    {
        if ($v !== null) {
            $v = (string) $v;
        }

        if ($this->version !== $v) {
            $this->version = $v;
            $this->modifiedColumns[] = RemoteHistoryContaoPeer::VERSION;
        }


        return $this;
    }
1280189
public function forVersions(VersionsCollection $versions) : Version
    {
        Assert::that($versions->count())
            ->greaterThan(0, 'Cannot determine latest minor version from an empty collection');

        $stableVersions = $versions->matching(new class implements ConstraintInterface {
            public function assert(Version $version) : bool
            {
                return ! $version->isPreRelease();
            }
        });

        $versionsSortedDescending = $stableVersions->sortedDescending();

        /** @var Version $lastVersion */
        $lastVersion = array_values(iterator_to_array($versionsSortedDescending))[0];

        $matchingMinorVersions = $stableVersions
            ->matching(new CompositeConstraint(
                CompositeConstraint::OPERATOR_AND,
                new ComparisonConstraint(ComparisonConstraint::OPERATOR_LTE, $lastVersion),
                new ComparisonConstraint(
                    ComparisonConstraint::OPERATOR_GTE,
                    Version::fromString($lastVersion->getMajor() . '.' . $lastVersion->getMinor() . '.0')
                )
            ))
            ->sortedAscending();

        /** @var Version[] $matchingMinorVersionsAsArray */
        $matchingMinorVersionsAsArray = array_values(iterator_to_array($matchingMinorVersions));

        return $matchingMinorVersionsAsArray[0];
    }
811303
protected function satisfyVersion(Link $require, $normalizedVersion)
    {
        $constraintSame = $this->versionParser->parseConstraints($normalizedVersion);
        $sameVersion = (bool) $require->getConstraint()->matches($constraintSame);

        $consNormalizedVersion = FilterUtil::getVersionConstraint($normalizedVersion, $this->versionParser);
        $constraint = FilterUtil::getVersionConstraint($consNormalizedVersion->getPrettyString(), $this->versionParser);

        return (bool) $require->getConstraint()->matches($constraint) || $sameVersion;
    }
27195
public function findPublishedVersionByLocator(LocatorInterface $locator)
    {
        $entity = $this->findActiveVersionByLocator($locator);

        if ($entity !== null && $entity->getStatus() === VersionStatuses::PUBLISHED) {
            return $entity;
        }

        return null;
    }
41738
private function initialize()
    {
        $adapter = $this->getAdapter();
        if (($adapter instanceof AdapterInterface) === false) {
            throw new InvalidArgumentException(sprintf('No adapter found to handle VCS repository "%s".', $this->repositoryUrl));
        }

        $this->repositoryAdapter = $adapter;
    }
1367438
private function selectRestVersion($channelXml, $supportedVersions)
    {
        $channelXml->registerXPathNamespace('ns', self::CHANNEL_NS);

        foreach ($supportedVersions as $version) {
            $xpathTest = "ns:servers/ns:primary/ns:rest/ns:baseurl[@type='{$version}']";
            $testResult = $channelXml->xpath($xpathTest);
            if (count($testResult) > 0) {
                return array('version' => $version, 'baseUrl' => (string) $testResult[0]);
            }
        }

        return null;
    }
37766
def detect_vcs():
    """"""
    location = os.path.abspath('.')
    while True:
        for vcs in Git, Mercurial, Bazaar, Subversion:
            if vcs.detect(location):
                return vcs
        parent = os.path.dirname(location)
        if parent == location:
            raise Failure("Couldn't find version control data"
                          " (git/hg/bzr/svn supported)")
        location = parent
660758
protected function findBestConstraint($existingVersion)
    {
        // Cannot guess without existing version
        if (!$existingVersion) {
            return null;
        }

        // Existing version is already a ^1.0.0 or ~1.0.0 constraint
        if (preg_match('#^[~^]#', $existingVersion)) {
            return $existingVersion;
        }

        // Existing version is already a dev constraint
        if (stristr($existingVersion, 'dev') !== false) {
            return $existingVersion;
        }

        // Numeric-only version maps to semver constraint
        if (preg_match('#^([\d.]+)$#', $existingVersion)) {
            return "^{$existingVersion}";
        }

        // Cannot guess; Let composer choose (equivalent to `composer require vendor/library`)
        return null;
    }
1211450
public function withProtocolVersion($version)
    {
        $request = clone $this;
        if (method_exists($request, 'setProtocolVersion')) {
            $request->setProtocolVersion($version);
        } else {
            $request->server->set('SERVER_PROTOCOL', $version);
        }

        return $request;
    }
126685
protected function registerSupportedVersions(VersionControl $version): void
    {
        foreach ($this->versions as $code => $namespace) {
            $version->addVersion($code, $namespace);
        }

        if (! is_null($this->defaultVersion)) {
            $version->setDefaultVersion($this->defaultVersion);
        }
    }
215653
public function getServiceUrl($version = null)
    {
        if ($version) {
            return $this->getWebserviceUrl() . $this->getServicePath($version);
        } else {
            return $this->getWebserviceUrl() . $this->getServicePath();
        }
    }
363344
public function withProtocolVersion($version)
    {
        $response = $this->_withProtocolVersion($version);
        
        if ($response->status instanceof GlobalResponseStatus) {
            $response->status = $response->status->withProtocolVersion($response->getProtocolVersion());
        }
        
        return $response;
    }