Check if provider supports a specific version of the game.

@param Version $version

@return bool

@throws InvalidResponseException
480957
public function supportsVersion(Version $version) : bool
    {
        try {
            $this->getVersionUrl($version);
        } catch (UnsupportedVersionException $e) {
            return false;
        }

        return true;
    }
206516
protected function isSourceAlreadyFetched($version) : bool
    {
        $storagePath = $this->config['download_path'].'/'.$version;
        if (! File::exists($storagePath) || empty(File::directories($storagePath))
        ) {
            return false;
        }

        return true;
    }
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];
    }
1271721
public function setVersion($version)
    {
        if($version < 0 || $version > Constants::QRSPEC_VERSION_MAX) {
            throw new Exception('Invalid version no');
            return -1;
        }

        $this->version = $version;

        return 0;
    }
260532
public static function validateVersion($requiredVersion, $composerVersion)
    {
        if (false === strpos($composerVersion, '@') && !version_compare($composerVersion, $requiredVersion, '>=')) {
            $msg = 'Foxy requires the Composer\'s minimum version "%s", current version is "%s"';

            throw new RuntimeException(sprintf($msg, $requiredVersion, $composerVersion));
        }
    }
574618
public function useVersion(string $version)
    {
        if (! \array_key_exists($version, $this->supportedVersions)) {
            throw new InvalidArgumentException("API version [{$version}] is not supported.");
        }

        $this->defaultVersion = $version;

        return $this;
    }
45166
public function equals($httpVersion): bool
    {
        if (empty($httpVersion)) {
            return false;
        }

        try {
            $other = self::castFrom($httpVersion);
        } catch (\InvalidArgumentException $iae) {
            return false;
        }

        return $this->major() === $other->major() && $this->minor() === $other->minor();
    }
551048
public function setVersion(string $version)
    {
        if (!preg_match('/^\d+\.\d+\.\d+$/', $version)) {
            throw new \InvalidArgumentException(
                'Version number is invalid; ' . $version . ' does not match '
                . 'x.x.x (where x is a number)'
            );
        }

        $this->version = $version;
    }
813638
public boolean validateVersionType(String versionType, DiagnosticChain diagnostics, Map<Object, Object> context) {
		return true;
	}
1004599
public function compareVersions($version1, $version2)
    {
        $versions = $this->getVersions();
        $key1 = array_search($version1, $versions);
        $key2 = array_search($version2, $versions);

        if ($key1 === false ||
             $key2 === false)
        {
            return 0;
        }

        return $key1 - $key2;
    }
1042524
public function setVersion($version)
    {
        $availableVersions = ['v1'];

        if (in_array($version, $availableVersions)) {
            $this->version = $version;

            $this->initConfiguration();

            return $this;
        }

        throw new InvalidArgument(
            'Invalid Consumer API version, available versions are: ' . implode(', ', $availableVersions)
        );
    }
412352
protected function filterProtocolVersion($version)
    {
        if (!is_string($version) || !in_array($version, $this->protocols)) {
            throw new \InvalidArgumentException('The specified protocol is invalid.');
        }

        return $version;
    }
480219
protected function assertProtocolVersion($version)
    {
        if (!is_string($version) && !is_numeric($version)) {
            throw new \InvalidArgumentException("HTTP version must be a string or float");
        }
        
        if ($version != '' && $version !== "1.0" && $version !== "1.1" && $version !== "2") {
            throw new \InvalidArgumentException("Invalid HTTP protocol version '$version'");
        }
    }
41632
public function specials($package, Version $version)
    {
        $specials = $this->searchProvides($package);
        if ($specials) {
            $this->providesJsonDetected = true;
        } else {
            $this->providesJsonDetected = false;
            $specials = $this->searchReflect($package, $version);
        }
        if (count($specials['providers']) === 0 && count($specials['aliases']) === 0) {
            return false;
        }
        return $specials;
    }
84054
private function filterByPhpVersion(array $versions)
    {
        $versionInfo = $this->getAvailableVersions();

        return array_filter($versions, function ($version) use ($versionInfo) {
            if (isset($versionInfo[$version]['php']['min'])
                && version_compare(PHP_VERSION, $versionInfo[$version]['php']['min'], '<')) {
                return false;
            } elseif (isset($versionInfo[$version]['php']['max'])
                && version_compare(PHP_VERSION, $versionInfo[$version]['php']['max'], '>')) {
                return false;
            }

            return true;
        });
    }
410761
public static function isMatch($constraint, Version $version, &$failures = array())
    {
        foreach (explode(',', $constraint) as $constraintExpression) {
            $c = self::fromString($constraintExpression);
            if (!$c->match($version)) {
                $failures[]= "Constraint '$constraintExpression' failed";
            }
        }
        return count($failures) === 0;
    }
209688
public function can_upgrade($type, $version) {

        $uploadsingletype ='uploadsingle';
        $uploadtype ='upload';

        if (($type == $uploadsingletype || $type == $uploadtype) && $version >= 2011112900) {
            return true;
        }
        return false;
    }