Analyze the sub version of splitted version.

@param int   $i        The position in splitted version
@param array $exp      The splitted version
@param bool  $increase Check if the next sub version must be increased

@return bool
495314
protected static function analyzeSubVersion($i, array &$exp, &$increase)
    {
        $analyzed = false;

        if ($increase) {
            $exp[$i] = 0;
            $analyzed = true;
        }

        if (0 === $i && (int) $exp[$i] > 0) {
            $increase = true;
            $exp[$i] = (int) $exp[$i] + 1;
            $analyzed = true;
        }

        return $analyzed;
    }
489696
protected static function exch(array &$arr, int $i, int $j): void
    {
        $temp = $arr[$i];
        $arr[$i] = $arr[$j];
        $arr[$j] = $temp;
    }
587982
public static function hasExtension(string $uri, string $extension): bool
    {
        $extension       = '.' . ltrim($extension, '.');
        $uriLength       = mb_strlen($uri);
        $extensionLength = mb_strlen($extension);
        if ($extensionLength > $uriLength) {
            return false;
        }

        return substr_compare($uri, $extension, $uriLength - $extensionLength, $extensionLength) === 0;
    }
391094
def split_ext(path, basename=True):
    """"""
    if basename:
        path = os.path.basename(path)
    return os.path.splitext(path)
1053271
function splitter(target, splitExp) {
		var mw = core.base();
		mw.enabled = true;
		mw.splitExp = (splitExp || /\r?\n/g);
		mw.target = target;
		mw.writeln = function (str) {
			if (mw.enabled) {
				str = String(str);
				var start = 0;
				var match;

				mw.splitExp.lastIndex = 0;
				while ((match = mw.splitExp.exec(str))) {
					var line = str.substring(start, match.index);
					start = match.index + match[0].length;
					mw.splitExp.lastIndex = start;
					mw.target.writeln(line);
				}
				// append piece after final linebreak (or final blank line)
				if (start < str.length || start === str.length) {
					mw.target.writeln(str.substr(start));
				}
			}
		};
		mw.toString = function () {
			return '<miniwrite-splitter>';
		};
		return mw;
	}
332679
protected static function getSplittedVersion($version)
    {
        $version = static::cleanExtraVersion($version);
        $version = str_replace(array('*', 'x', 'X'), '9999999', $version);
        $exp = explode('.', $version);

        return $exp;
    }
842046
public function findRecent(Version $version, $major = false, $pre = false)
    {
        /** @var $current Update */
        $current = null;
        $major = $major ? $version->getMajor() : null;

        foreach ($this->updates as $update) {
            if ($major && ($major !== $update->getVersion()->getMajor())) {
                continue;
            }

            if ((false === $pre)
                && !$update->getVersion()->isStable()) {
                continue;
            }

            $test = $current ? $current->getVersion() : $version;

            if (false === $update->isNewer($test)) {
                continue;
            }

            $current = $update;
        }

        return $current;
    }
1271066
protected function getStringToken($exp, $length, & $i)
	{
		if($exp[$i] == '"' || $exp[$i] == "'")
		{
			$delim = $exp[$i++];
			$buffer = '';
			
			$terminated = false;
			$escaped = false;
			
			for(; $i < $length; $i++)
			{
				if($exp[$i] == '\\')
				{
					$escaped = !$escaped;
				}
				elseif($exp[$i] == $delim && !$escaped)
				{
					$terminated = true;
					
					break;
				}
				else
				{
					$escaped = false;
				}
				
				$buffer .= $exp[$i];
			}
			
			if($terminated)
			{
				return new AnnotationToken(AnnotationToken::T_STRING, str_replace('\\' . $delim, $delim, $buffer));
			}
		}
	}
1088495
private function extend($Ee, $Em)
    {
        $u1 = '1';
        $u2 = '0';
        $u3 = $Em;
        $v1 = '0';
        $v2 = '1';
        $v3 = $Ee;
        while (bccomp($v3, 0) != 0) {
            $qq = bcdiv($u3, $v3, 0);
            $t1 = bcsub($u1, bcmul($qq, $v1));
            $t2 = bcsub($u2, bcmul($qq, $v2));
            $t3 = bcsub($u3, bcmul($qq, $v3));
            $u1 = $v1;
            $u2 = $v2;
            $u3 = $v3;
            $v1 = $t1;
            $v2 = $t2;
            $v3 = $t3;
            $z = '1';
        }
        $uu = $u1;
        $vv = $u2;
        if (bccomp($vv, 0) == -1) {
            $inverse = bcadd($vv, $Em);
        } else {
            $inverse = $vv;
        }

        return $inverse;
    }
613655
function loadExtension($ext)
    {
        if (extension_loaded($ext)) {
            return true;
        }

        // if either returns true dl() will produce a FATAL error, stop that
        if (
            function_exists('dl') === false ||
            ini_get('enable_dl') != 1 ||
            ini_get('safe_mode') == 1
        ) {
            return false;
        }

        if (OS_WINDOWS) {
            $suffix = '.dll';
        } elseif (PHP_OS == 'HP-UX') {
            $suffix = '.sl';
        } elseif (PHP_OS == 'AIX') {
            $suffix = '.a';
        } elseif (PHP_OS == 'OSX') {
            $suffix = '.bundle';
        } else {
            $suffix = '.so';
        }

        return @dl('php_'.$ext.$suffix) || @dl($ext.$suffix);
    }
825230
public static function after($arr, $i) {
		$res = [];
		$do = false;
		foreach($arr as $k=>$v) {
			if($do)
				$res[$k] = $v;
			if($k === $i)
				$do = true;
		}
		return $res;
	}
503584
protected function expand_format_expression($format) {

		$increment = 1;

		if(strpos($format, '/') !== false) {
			list($format, $increment) = explode('/', $format, 2);
			$increment = ($increment === '*') ? 1 : (int) $increment;
		}

		$parts = explode('-', $format, 2);

		$start = array_shift($parts);
		$end = array_shift($parts);

		if($start === '*') $start = $this->min;
		if($end === null) $end = $this->max;

		$start = max($this->min, $start);
		$end = min($this->max, $end);

		if( ($end - $start) < $increment) return array($start);
		return range($start, $end, $increment);

	}
983862
protected function expHelper($lhs, $minP)
    {
        $this->inExp = true;
        $ss = $this->seek();

        while (true) {
            $whiteBefore = isset($this->buffer[$this->count - 1]) &&
                ctype_space($this->buffer[$this->count - 1]);

            // If there is whitespace before the operator, then we require
            // whitespace after the operator for it to be an expression
            $needWhite = $whiteBefore && !$this->inParens;

            if ($this->match(self::$operatorString.($needWhite ? '\s' : ''), $m) && self::$precedence[$m[1]] >= $minP) {
                if (!$this->inParens && isset($this->env->currentProperty) && $m[1] == '/' && empty($this->env->supressedDivision)) {
                    foreach (self::$supressDivisionProps as $pattern) {
                        if (preg_match($pattern, $this->env->currentProperty)) {
                            $this->env->supressedDivision = true;
                            break 2;
                        }
                    }
                }

                $whiteAfter = isset($this->buffer[$this->count - 1]) &&
                    ctype_space($this->buffer[$this->count - 1]);

                if (!$this->value($rhs)) {
                    break;
                }

                // peek for next operator to see what to do with rhs
                if ($this->peek(self::$operatorString, $next) && self::$precedence[$next[1]] > self::$precedence[$m[1]]) {
                    $rhs = $this->expHelper($rhs, self::$precedence[$next[1]]);
                }

                $lhs = array('expression', $m[1], $lhs, $rhs, $whiteBefore, $whiteAfter);
                $ss = $this->seek();

                continue;
            }

            break;
        }

        $this->seek($ss);

        return $lhs;
    }
657516
private function split()
    {
        if (count($parts = explode('/', trim($this->product . '/' . $this->version, '/'), 2)) === 2) {
            $this->product = $parts[0];
            $this->version = $parts[1];
        }
        return true;
    }
1057022
function (version, semverIndex)
	{
		const splittedVersion = version.split('.');
		splittedVersion[ semverIndex ] = parseInt(splittedVersion[ semverIndex ], 10) + 1;
		while (semverIndex < 2)
		{
			splittedVersion[ ++semverIndex ] = '0';
		}
		return splittedVersion.join('.');
	}
624694
public function acceptsExtension($ext)
    {
        $ext = trim(strtolower($ext), ".");

        if ($this->getRequiredExtension() && $ext !== $this->getRequiredExtension()) {
            return false;
        }

        if ($this->getAllowedExtensions() && !in_array($ext, $this->getAllowedExtensions())) {
            return false;
        }

        if ($this->getRejectedExtensions() && in_array($ext, $this->getRejectedExtensions())) {
            return false;
        }

        return true;
    }
40398
protected function _removeBlob($str, $i)
    {
        if ($str[$i] !== '[') {
            return false;
        }

        ++$i;

        for ($cnt = strlen($str); $i < $cnt; ++$i) {
            if ($str[$i] === ']') {
                break;
            }

            if ($str[$i] === '[') {
                return false;
            }
        }

        if ($i === ($cnt - 1)) {
            return false;
        }

        ++$i;

        if ($str[$i] === ' ') {
            ++$i;
        }

        return $i;
    }