Sets target API version (optionally)
@param string $version
435435
public function setAPIversion($version = '1')
    {
        preg_match('/\d+/', trim($version), $matches);

        if (count($matches) === 1) {
            $this->api_version = $matches[0];
        }
    }
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;
    }
769017
public function setApiVersion($version)
    {
        if (!in_array($version, $this->availableVersions, true)) {
            throw new UnsupportedStripeVersionException(sprintf(
                'The given Stripe version ("%s") is not supported by ZfrStripe. Value must be one of the following: "%s"',
                $version,
                implode(', ', $this->availableVersions)
            ));
        }

        $this->version = (string) $version;
        $this->setDefaultOption('headers', ['Stripe-Version' => $this->version]);

        if ($this->version < '2015-08-19') {
            $descriptor = __DIR__ . '/ServiceDescription/Stripe-v1.0.php';
        } else {
            $descriptor = __DIR__ . '/ServiceDescription/Stripe-v1.1.php';
        }

        // Note that we need to recreate a whole new CompositeFactory whenever the version is changed
        $this->setCommandFactory(new CompositeFactory());
        $this->setDescription(ServiceDescription::factory($descriptor));
    }
220165
public function setVersion($version)
    {
        $this->version
            = preg_match('/^' . self::REGEX_VECTOR . '$/ux', $version)
            ? $version
            : '';

        $this->content = null;
        return $this;
    }
1283294
public static function SetVersion($number)
    {
        self::CheckBackend();

        $number = trim($number);

        self::$backend->Set("version", $number);
    }
363013
public function setEnvProperty($name, $version)
    {
        if (! isset($this->data['env']) || ! is_array($this->data['env'])) {
            $this->data['env'] = [];
        }

        $this->data['env'][$name] = $version;
    }
727099
protected function setVersion($version)
    {
        try {
            // Prepare
            $currentVersion = $this->config['version'];
            // Replace in config file
            $this->replaceInFile($currentVersion, $version, $this->configFilename);
            // Replace in package.json
            $packageJson = json_decode(file_get_contents($this->rootPath.'/package.json'));
            $this->replaceInFile(
                '"version": "'.$packageJson->version.'"',
                '"version": "'.$version.'"',
                $this->rootPath.'/package.json'
            );
            // Replace in project
            $filename = $this->config['type'] === 'theme'
                ? $this->rootPath.'/style.css'
                : $this->rootPath.'/plugin.php';
            preg_match(
                '/[Vv]ersion\:[|\s][0-9\.vV]+/',
                file_get_contents($filename),
                $matches
            );
            if (count($matches) > 0)
                $this->replaceInFile(
                    $matches[0],
                    'Version: '.$version,
                    $filename
                );
            // Print end
            $this->_print('Version updated!');
            $this->_lineBreak();
        } catch (Exception $e) {
            file_put_contents(
                $this->rootPath.'/error_log',
                $e->getMessage()
            );
            throw new NoticeException('Command "'.$this->key.'": Fatal error ocurred.');
        }
    }
1103502
public function withVersion(int $version): self
    {
        $obj = clone $this;
        $obj->_version = $version;
        return $obj;
    }
997931
public function setProtocolVersion($httpVersion)
    {
        $httpVersion = (string)$httpVersion;

        if ($httpVersion !== '1.1' && $httpVersion !== '1.0') { //SPDY is not supported currently
            throw new InvalidArgumentException('Invalid (non-RFC) HTTP version.');
        }

        $this->protocolVersion = $httpVersion;
        $this->messageCache = null;
    }
412352
protected function filterProtocolVersion($version)
    {
        if (!is_string($version) || !in_array($version, $this->protocols)) {
            throw new \InvalidArgumentException('The specified protocol is invalid.');
        }

        return $version;
    }
57710
public function set(string $version): VersionInterface
    {
        $matches = [];
        $numbers = [];

        if (preg_match($this->regex, $version, $matches)) {
            $numbers = $this->mapMatches($matches);
        }

        if (empty($numbers)) {
            return new Version('0');
        }

        $major = (array_key_exists('major', $numbers) ? $numbers['major'] : '0');
        $minor = (array_key_exists('minor', $numbers) ? $numbers['minor'] : '0');

        if (array_key_exists('micro', $numbers)) {
            $micro      = $numbers['micro'];
            $patch      = (array_key_exists('patch', $numbers) ? $numbers['patch'] : null);
            $micropatch = (array_key_exists('micropatch', $numbers) ? $numbers['micropatch'] : null);
        } else {
            $micro      = '0';
            $patch      = null;
            $micropatch = null;
        }

        $stability = (array_key_exists('stability', $numbers)) ? $numbers['stability'] : null;

        if (null === $stability || 0 === mb_strlen($stability)) {
            $stability = 'stable';
        }

        $stability = mb_strtolower($stability);
        switch ($stability) {
            case 'rc':
                $stability = 'RC';

                break;
            case 'patch':
            case 'pl':
            case 'p':
                $stability = 'patch';

                break;
            case 'beta':
            case 'b':
                $stability = 'beta';

                break;
            case 'alpha':
            case 'a':
                $stability = 'alpha';

                break;
            case 'dev':
            case 'd':
                $stability = 'dev';

                break;
        }

        $build = (array_key_exists('build', $numbers)) ? $numbers['build'] : null;

        return new Version($major, $minor, $micro, $patch, $micropatch, $stability, $build);
    }
943058
public function withProtocolVersion($version)
    {
        if (!is_string($version)) {
            throw new \InvalidArgumentException("Expected protocol version to be a string");
        }
        
        $this->protocolVersion = $version;
        
        $this->sendStatusHeader();
        
        return $this;
    }
560701
public function writeVersion(Version $version)
    {
        $cacheItem = $this->cache->getItem('version');
        $cacheItem->set($version);

        $this->cache->save($cacheItem);
        $this->writer->write($version);
    }
171438
public function setApiVersion($apiVersion)
    {
        if ( ! in_array($apiVersion, self::$supportedApiVersions)) {
            throw new ApiVersionNotSupported(sprintf('API version %d is not supported.', $apiVersion));
        }
        $this->apiVersion = $apiVersion;
    }
1110124
public function tag( $version ) {

		$this->versionSet( $version );

		$this->taskGitStack()
		     ->stopOnFail()
		     ->add( 'laps.php' )
		     ->commit( "Updated header version to {$version}" )
		     ->tag( $version )
		     ->run();
	}
1082190
public function version($version = null)
    {
        if (func_num_args() === 0) {
            return $this->_version;
        }
        $headers = $this->headers();
        $headers->prepend('MIME-Version', $version);
        $this->_version = $version;
        return $this;
    }
765878
public function setCurrentVersion($version)
    {
        $version = min($this->getMaxVersion(), $version);
        $version = max($version, 0);
        $this->_getVersion()->version = $version;
        $this->_getVersion()->saveEntity();
    }