public static function check_pip_package_version($actual, $required = self::REQUIRED_PIP_PACKAGE_VERSION) {

        if (empty($actual)) {
            return -1;
        }

        if (version_compare($actual, $required, '<')) {
            return -1;
        }

        $parts = explode('.', $required);
        $requiredapiver = reset($parts);

        $parts = explode('.', $actual);
        $actualapiver = reset($parts);

        if ($requiredapiver > 0 || $actualapiver > 1) {
            if (version_compare($actual, $requiredapiver + 1, '>=')) {
                return 1;
            }
        }

        return 0;
    }
public static function check_pip_package_version($actual, $required = self::REQUIRED_PIP_PACKAGE_VERSION) {

        if (empty($actual)) {
            return -1;
        }

        if (version_compare($actual, $required, '<')) {
            return -1;
        }

        $parts = explode('.', $required);
        $requiredapiver = reset($parts);

        $parts = explode('.', $actual);
        $actualapiver = reset($parts);

        if ($requiredapiver > 0 || $actualapiver > 1) {
            if (version_compare($actual, $requiredapiver + 1, '>=')) {
                return 1;
            }
        }

        return 0;
    }
public static function check_pip_package_version ( $ actual , $ required = self :: REQUIRED_PIP_PACKAGE_VERSION ) { if ( empty ( $ actual ) ) { return - 1 ; } if ( version_compare ( $ actual , $ required , '<' ) ) { return - 1 ; } $ parts = explode ( '.' , $ required ) ; $ requiredapiver = reset ( $ parts ) ; $ parts = explode ( '.' , $ actual ) ; $ actualapiver = reset ( $ parts ) ; if ( $ requiredapiver > 0 || $ actualapiver > 1 ) { if ( version_compare ( $ actual , $ requiredapiver + 1 , '>=' ) ) { return 1 ; } } return 0 ; }
Check that the given package version can be used and return the error status.

When evaluating the version, we assume the sematic versioning scheme as described at
https://semver.org/.

@param string $actual The actual Python package version
@param string $required The required version of the package
@return int -1 = actual version is too low, 1 = actual version too high, 0 = actual version is ok
Check that the given package version can be used and return the error status .