Return the version before the given version.

@param string $from
620
public function getPreviousVersion($from)
    {
        $lastTimestamp = 0;
        foreach (array_keys($this->versions) as $timestamp) {
            if ($timestamp == $from) {
                return $lastTimestamp;
            }
            $lastTimestamp = $timestamp;
        }

        return 0;
    }
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 )
		);
	}
282801
private function getReplacementString($from, $to)
    {
        if (is_array($from) && is_array($to)) {
            if (count($from) == count($to)) {
                $sedStrings = [];
                $fromSize = count($from);
                for ($i = 0; $i < $fromSize; $i++) {
                    $sedStrings[] = $this->getReplacementCommand($from[$i], $to[$i]);
                }
                return implode(';', $sedStrings);
            } else {
                throw new InvalidArgumentException("Number of items in 'fromText' (" . count($from) . ") is different to 'toText' (" . count($to) . ")");
            }
        } elseif (is_array($from) || is_array($to)) {
            throw new InvalidArgumentException("Only one of fromText or toText is an array, both should be arrays or string");
        } else {
            return $this->getReplacementCommand($from, $to);
        }
    }
346923
public function isIIS($fromVersion = 7)
    {
        $webserver = $this->findWebserver();
        if (preg_match('#.*IIS/(?<version>[.\\d]+)$#', $webserver, $matches)) {
            return version_compare($matches['version'], $fromVersion, '>=');
        }
        return false;
    }
825912
public static function get_between_versions($package = 'project', \Datetime $start_date = null, \Datetime $end_date = null) {
		$migrations = self::get_by_package($package);

		foreach ($migrations as $key => $migration) {
			if ($start_date !== null) {
				if ($migration->get_version() <= $start_date) {
					unset($migrations[$key]);
					continue;
				}
			}

			if ($end_date !== null) {
				if ($migration->get_version() >= $end_date) {
					unset($migrations[$key]);
					continue;
				}
			}
		}
		return $migrations;
	}
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));
    }
996493
def _get_version():
    """"""
    with open("../waliki/__init__.py") as fh:
        for line in fh:
            if line.startswith("__version__ = "):
                return line.split("=")[-1].strip().strip("'").strip('"')
562349
protected function getMappedFile($from)
    {
        if (!$this->mapperElement) {
            throw new BuildException("This task requires you to use a <mapper/> element to describe how filename changes should be handled.");
        }

        $mapper = $this->mapperElement->getImplementation();
        $mapped = $mapper->main($from);
        if (!$mapped) {
            throw new BuildException("Cannot create new filename based on: " . $from);
        }
        // Mappers always return arrays since it's possible for some mappers to map to multiple names.
        $outFilename = array_shift($mapped);
        $outFile = new PhingFile($this->getOutputDirectory(), $outFilename);

        return $outFile;
    }
889193
private function getRelativeUrl($from, $to)
	{
		$relative = '';
		while (true)
		{
			if ($from === $to)
				return $relative;
			else if ($from === dirname($from))
				return $relative . substr($to, 1);
			if (!strncmp($from . '/', $to, strlen($from) + 1))
				return $relative . substr($to, strlen($from) + 1);

			$from = dirname($from);
			$relative .= '../';
		}
	}
1206382
public function getNextSet(int $from) : int
    {
        if ($from >= $this->size) {
            return $this->size;
        }

        $bitsOffset = $from >> 5;
        $currentBits = $this->bits[$bitsOffset];
        $bitsLength = count($this->bits);
        $currentBits &= ~((1 << ($from & 0x1f)) - 1);

        while (0 === $currentBits) {
            if (++$bitsOffset === $bitsLength) {
                return $this->size;
            }

            $currentBits = $this->bits[$bitsOffset];
        }

        $result = ($bitsOffset << 5) + BitUtils::numberOfTrailingZeros($currentBits);
        return $result > $this->size ? $this->size : $result;
    }
437788
public static function compare($version)
    {
        $currentVersion = str_replace(' ', '', strtolower(self::VERSION));
        $version        = str_replace(' ', '', $version);

        return version_compare($version, $currentVersion);
    }
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'};
    }
420364
protected function getSlugSource($from): string
    {
        if (is_null($from)) {
            return $this->model->__toString();
        }

        $sourceStrings = array_map(function($key) {
            $value = data_get($this->model, $key);
            if (is_bool($value)) {
                $value = (int) $value;
            }

            return $value;
        }, (array) $from);

        return implode($sourceStrings, ' ');
    }
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;
    }
491688
public static function getVersion(string $version = ''): string
    {
        if ($version === '') {
            $version = PrettyVersions::getVersion('api-clients/pusher')->getFullVersion();
        }

        list($version, $hash) = explode('@', $version);

        if (strpos($version, 'dev') !== false) {
            return '0.0.1-' . $hash;
        }

        return $version;
    }
719237
public function getVersion($of = 'atk')
    {
        // TODO: get version of add-on
        if (!$this->version_cache) {
            $f = $this->app->pathfinder->atk_location->base_path.DIRECTORY_SEPARATOR.'VERSION';
            if (file_exists($f)) {
                $this->version_cache = trim(file_get_contents($f));
            } else {
                $this->version_cache = '4.0.1';
            }
        }

        return $this->version_cache;
    }
1154658
public function getLastVersionNumber($con = null)
    {
        $v = ChildDealerContactVersionQuery::create()
            ->filterByDealerContact($this)
            ->orderByVersion('desc')
            ->findOne($con);
        if (!$v) {
            return 0;
        }

        return $v->getVersion();
    }