Formats and prints a pending version with the given style.

@param Version $version The Version to print.
@param string $style One of the STYLE_* constants.
13566
protected function printPendingVersion(Version $version, $style)
    {
        /** @var Version $version */
        $id = $version->getId();
        $reflectionClass = new \ReflectionClass($version->getMigration());
        $absolutePath = $reflectionClass->getFileName();
        $fileName = $absolutePath ? $this->getRelativePath(getcwd(), $absolutePath) : '';
        $this->output->writeln("\t<$style>[$id] $fileName</$style>");
    }
1111747
public function setVersion($version, $id = false)
    {
        if ($id === false) {
            $id = $this->getMainBlock()->getId();
        }

        $this->versionMap[$id] = $version;
    }
1106791
public boolean recordVersion(String version) {
    if (currentInfo.documentVersion(version)) {
      populated = true;
      return true;
    } else {
      return false;
    }
  }
863277
public function handleVersionedService($version, $service, $resource = null)
    {
        $request = new ServiceRequest();
        $request->setApiVersion($version);

        return $this->handleServiceRequest($request, $service, $resource);
    }
155602
public static function formatVersion($version)
    {
        return sprintf('%s-%s-%s %s:%s:%s',
            substr($version, 0, 4),
            substr($version, 4, 2),
            substr($version, 6, 2),
            substr($version, 8, 2),
            substr($version, 10, 2),
            substr($version, 12, 2)
        );
    }
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.');
        }
    }
883166
public function setVersion(ResourceInterface $resource, $version) {
		if ($resource instanceof ResourceDocument) {
			$resource->addMeta($this->getKeyword('version'), $version, $level=Document::LEVEL_RESOURCE);
		}
		else {
			$resource->addMeta($this->getKeyword('version'), $version);
		}
	}
1227237
public static function setApplicationVersion(string $version): void
    {
        if (self::isCliApp()) {
            self::$APPLICATION_VERSION = $version;
        } else {
            MSession::set(MCoreApplication::APPLICATION_VERSION, $version);
        }
    }
825222
public function shouldProcess(Version $version)
    {
        $result = false;
        $versionTypeObject = $version->getTypeObject();
        if ($versionTypeObject->getGenericType() == Type::T_IMAGE && !$versionTypeObject->isSVG()) {
            if ($result === false && $this->maxWidth !== null) {
                $imageWidth = (int) $version->getAttribute('width');
                if ($imageWidth > $this->maxWidth) {
                    $result = true;
                }
            }
            if ($result === false && $this->maxHeight !== null) {
                $imageHeight = (int) $version->getAttribute('height');
                if ($imageHeight > $this->maxHeight) {
                    $result = true;
                }
            }
        }

        return $result;
    }
773964
public static function isValidProtocolVersion($version)
    {
        if (!is_string($version) || empty($version)) {
            return false;
        }

        return (bool) preg_match('#^(1\.[01]|2)$#', $version);
    }
1110124
public function tag( $version ) {

		$this->versionSet( $version );

		$this->taskGitStack()
		     ->stopOnFail()
		     ->add( 'laps.php' )
		     ->commit( "Updated header version to {$version}" )
		     ->tag( $version )
		     ->run();
	}
1278369
public static function isValid ($version)
    {
        if (self::isDev($version)) {
            return true;
        } else {
            return (boolean) preg_match('/' . self::$validPattern . '/i', $version);
        }
    }
757478
private static function formatVersion($version)
    {
        $version = str_replace(array('x', 'X', '*'), '0', $version);
        $exp = explode('.', $version);

        if (($size = \count($exp)) < 3) {
            for ($i = $size; $i < 3; ++$i) {
                $exp[] = '0';
            }
        }

        return $exp[0].'.'.$exp[1].'.'.$exp[2];
    }
165808
public static function compare($version)
    {
        $version = strtolower($version);
        $version = preg_replace('/(\d)pr(\d?)/', '$1a$2', $version);
        return version_compare($version, strtolower(static::VERSION));
    }
1166027
private function validateProtocolVersion($version): void
    {
        if (empty($version)) {
            throw new \InvalidArgumentException(
                'HTTP protocol version can not be empty'
            );
        }
        if (!\is_string($version)) {
            throw new \InvalidArgumentException(sprintf(
                'Unsupported HTTP protocol version; must be a string, received %s',
                (\is_object($version) ? \get_class($version) : \gettype($version))
            ));
        }

        // HTTP/1 uses a "<major>.<minor>" numbering scheme to indicate
        // versions of the protocol, while HTTP/2 does not.
        if (!\preg_match('#^(1\.[01]|2)$#', $version)) {
            throw new \InvalidArgumentException(\sprintf(
                'Unsupported HTTP protocol version "%s" provided',
                $version
            ));
        }
    }
1254115
public function formatLine(string $format, array $item, array $style = [])
    {
        foreach ($item as $key => $value) {
            $value = (isset($style[$key]) && ! empty($style[$key])) ?
                    "<{$style[$key]}>{$value}</>" :
                    $value;
            $format = str_replace("<{$key}>", $value, $format);
        }

        $this->output->writeln($format);
    }
37911
public function update(OutputStyle $output): void
    {
        $result = $this->updater->update();

        if ($result) {
            $output->success(sprintf('Updated from version %s to %s.', $this->updater->getOldVersion(),
                $this->updater->getNewVersion()));
            exit(0);
        } elseif (! $this->updater->getNewVersion()) {
            $output->success('There are no stable versions available.');
        } else {
            $output->success('You have the latest version installed.');
        }
    }