Translate version number to number of effective key bits.

@param int $version
@return int
559799
private static function _versionToEKB(int $version): int
    {
        static $lut;
        if ($version > 255) {
            return $version;
        }
        if (!isset($lut)) {
            $lut = array_flip(self::EKB_TABLE);
        }
        return $lut[$version];
    }
1055830
protected function legacyVersion($version)
    {
        $legacy = file_get_contents(__DIR__.'/../resources/legacy.json');

        $legacy = json_decode($legacy, true);

        return $legacy[$version];
    }
1359027
protected function getCompareVersion(Version $version)
    {
        if ($version->isDev()) {
            return substr(
                $version->getFullPretty(),
                strlen($version->getPretty()) + 1
            );
        }

        return $version->getPretty();
    }
1202700
public static function fromExtendedKeyVersion($version)
    {
        switch ($version) {
            case MainNet::HD_PRIVATE_KEY_ID:
            case MainNet::HD_PUBLIC_KEY_ID:
                return MainNet::instance();
            case TestNet::HD_PRIVATE_KEY_ID:
            case TestNet::HD_PUBLIC_KEY_ID:
                return TestNet::instance();
            default:
                throw new \InvalidArgumentException('Unknown extended key version.');
                break;
        }
    }
1334563
protected function getExplicitStability($version)
    {
        $found   = null;
        $pattern = $this->getPattern();

        foreach (static::splitConstraints($version) as $constraint) {
            if ( ! preg_match($pattern, $constraint, $match)) {
                continue;
            }

            $stability = $this->getStabilityInteger($match[1]);
            $found     = max($stability, $found);
        }

        return $found;
    }
861566
public function hasVersionMigrated(Version $version)
    {
        $this->createMigrationCollection();

        $record = $this->getCollection()->findOne(['v' => $version->getVersion()]);

        return null !== $record;
    }
563535
public function version($version = null)
    {
        if (!$version) {
            $versionParts = explode('.', \Peridot\Console\Version::NUMBER);
            $versionParts[count($versionParts)-1]++;
            $version = implode('.', $versionParts);
        }
        $versionFile = __DIR__ . '/src/Console/Version.php';
        $this->taskReplaceInFile($versionFile)
            ->from('NUMBER = "' . \Peridot\Console\Version::NUMBER . '"')
            ->to('NUMBER = "' . $version . '"')
            ->run();

        return $version;
    }
422570
public function asVersion($version) {
        $result = array();

        foreach (get_object_vars($this) as $property => $value) {
            //
            // skip properties that start with an underscore to allow
            // storing information that isn't included in statement
            // structure etc. (see Attachment.content for example)
            //
            if (strpos($property, '_') === 0) {
                continue;
            }

            if ($value instanceof VersionableInterface) {
                $value = $value->asVersion($version);
            }
            elseif (is_array($value) && !empty($value)) {
                $tmp_value = array();
                foreach ($value as $element) {
                    if ($element instanceof VersionableInterface) {
                        array_push($tmp_value, $element->asVersion($version));
                    }
                    else {
                        array_push($tmp_value, $element);
                    }
                }
                $value = $tmp_value;
            }

            if (isset($value) && (!is_array($value) || !empty($value))) {
                $result[$property] = $value;
            }
        }

        if (method_exists($this, '_asVersion')) {
            $this->_asVersion($result, $version);
        }

        return $result;
    }
931656
protected function getVersion($version)
    {
        if (!$this->{$version.'Version'}) {
            $revisioned = get_class($this->revisioned);

            $revision = new $revisioned();
            $revision->setRawAttributes($this->{$version});

            $this->{$version.'Version'} = $revision;
        }

        return $this->{$version.'Version'};
    }
123566
public static function lengthIndicator($mode, $version)
        {
            if ($mode == QR_MODE_STRUCTURE)
                return 0;
                
            if ($version <= 9) {
                $l = 0;
            } else if ($version <= 26) {
                $l = 1;
            } else {
                $l = 2;
            }

            return self::$lengthTableBits[$mode][$l];
        }
632818
public function setVersion($version)
    {
        // Set version
        $this->version = $version;

        // Split version into major, minor and patch
        $version = explode('.', $version);
        if (count($version) == 1) {
            array_push($version, 0, 0);
        }

        // Set major, minor and patch version
        $this->majorVersion = (int) isset($version[0]) ? $version[0] : 0;
        $this->minorVersion = (int) isset($version[1]) ? $version[1] : 0;
        $this->patchVersion = (int) isset($version[2]) ? $version[2] : 0;

        return $this;
    }
68338
public static function convertDateVersion($version)
    {
        if (preg_match('/^\d{7,}\./', $version)) {
            $pos = strpos($version, '.');
            $version = substr($version, 0, $pos).self::convertDateMinorVersion(substr($version, $pos + 1));
        }

        return $version;
    }
696103
public static function version2string($version)
    {
        switch($version)
        {   // fall-through's are on purpose
            case self::SEPA_PAIN_001_001_03_GBIC:
            case self::SEPA_PAIN_001_001_03: return 'pain.001.001.03';
            case self::SEPA_PAIN_001_002_03: return 'pain.001.002.03';
            case self::SEPA_PAIN_001_003_03: return 'pain.001.003.03';
            case self::SEPA_PAIN_008_001_02_GBIC:
            case self::SEPA_PAIN_008_001_02_AUSTRIAN_003:
            case self::SEPA_PAIN_008_001_02: return 'pain.008.001.02';
            case self::SEPA_PAIN_008_002_02: return 'pain.008.002.02';
            case self::SEPA_PAIN_008_003_02: return 'pain.008.003.02';
            default: return false;
        }
    }
178420
public static function compareVersion($version1, $version2)
    {
        if ($version1 == $version2) {
            return 0;
        }

        $v1 = Parser::parse($version1);
        $v2 = Parser::parse($version2);

        return self::compare($v1, $v2);
    }
111265
public function committedVersion(): ?int
    {
        if ($this->committedVersion === null) {
            $this->committedVersion = $this->eventCollection()->committedSequence();
        }

        return $this->committedVersion;
    }
446254
public function php_at_least( $version ) {
		return $this->add_check(
			function() use ( $version ) {
				return version_compare( phpversion(), $version, '>=' );
			},
			sprintf( 'PHP %s or newer is required', $version )
		);
	}
1105073
public static function getSymfonyVersion($version)
    {
        return implode('.', \array_slice(array_map(static function ($val) {
            return (int) $val;
        }, explode('.', $version)), 0, 3));
    }