src/xPDO/Transport/xPDOTransport.php
public static function satisfies($version, $constraint) {
        $satisfied = false;
        $constraint = trim($constraint);
        if (substr($constraint, 0, 1) === '~') {
            $requirement = substr($constraint, 1);
            $constraint = ">={$requirement},<" . self::nextSignificantRelease($requirement);
        }
        if (strpos($constraint, ',') !== false) {
            $exploded = explode(',', $constraint);
            array_walk($exploded, 'trim');
            $satisfies = array();
            foreach ($exploded as $requirement) {
                $satisfies[] = self::satisfies($version, $requirement);
            }
            $satisfied = (false === array_search(false, $satisfies, true));
        } elseif (($wildcardPos = strpos($constraint, '.*')) > 0) {
            $requirement = substr($constraint, 0, $wildcardPos + 1);
            $requirements = array(
                ">=" . $requirement,
                "<" . self::nextSignificantRelease($requirement)
            );
            $satisfies = array();
            foreach ($requirements as $requires) {
                $satisfies[] = self::satisfies($version, $requires);
            }
            $satisfied = (false === array_search(false, $satisfies, true));
        } elseif (in_array(substr($constraint, 0, 1), array('<', '>', '!'))) {
            $operator = substr($constraint, 0, 1);
            $versionPos = 1;
            if (substr($constraint, 1, 1) === '=') {
                $operator .= substr($constraint, 1, 1);
                $versionPos++;
            }
            $requirement = substr($constraint, $versionPos);
            $satisfied = version_compare($version, $requirement, $operator);
        } elseif ($constraint === '*') {
            $satisfied = true;
        } elseif (version_compare($version, $constraint) === 0) {
            $satisfied = true;
        }
        return $satisfied;
    }
public static function satisfies($version, $constraint) {
        $satisfied = false;
        $constraint = trim($constraint);
        if (substr($constraint, 0, 1) === '~') {
            $requirement = substr($constraint, 1);
            $constraint = ">={$requirement},<" . self::nextSignificantRelease($requirement);
        }
        if (strpos($constraint, ',') !== false) {
            $exploded = explode(',', $constraint);
            array_walk($exploded, 'trim');
            $satisfies = array();
            foreach ($exploded as $requirement) {
                $satisfies[] = self::satisfies($version, $requirement);
            }
            $satisfied = (false === array_search(false, $satisfies, true));
        } elseif (($wildcardPos = strpos($constraint, '.*')) > 0) {
            $requirement = substr($constraint, 0, $wildcardPos + 1);
            $requirements = array(
                ">=" . $requirement,
                "<" . self::nextSignificantRelease($requirement)
            );
            $satisfies = array();
            foreach ($requirements as $requires) {
                $satisfies[] = self::satisfies($version, $requires);
            }
            $satisfied = (false === array_search(false, $satisfies, true));
        } elseif (in_array(substr($constraint, 0, 1), array('<', '>', '!'))) {
            $operator = substr($constraint, 0, 1);
            $versionPos = 1;
            if (substr($constraint, 1, 1) === '=') {
                $operator .= substr($constraint, 1, 1);
                $versionPos++;
            }
            $requirement = substr($constraint, $versionPos);
            $satisfied = version_compare($version, $requirement, $operator);
        } elseif ($constraint === '*') {
            $satisfied = true;
        } elseif (version_compare($version, $constraint) === 0) {
            $satisfied = true;
        }
        return $satisfied;
    }
public static function satisfies ( $ version , $ constraint ) { $ satisfied = false ; $ constraint = trim ( $ constraint ) ; if ( substr ( $ constraint , 0 , 1 ) === '~' ) { $ requirement = substr ( $ constraint , 1 ) ; $ constraint = ">={$requirement},<" . self :: nextSignificantRelease ( $ requirement ) ; } if ( strpos ( $ constraint , ',' ) !== false ) { $ exploded = explode ( ',' , $ constraint ) ; array_walk ( $ exploded , 'trim' ) ; $ satisfies = array ( ) ; foreach ( $ exploded as $ requirement ) { $ satisfies [ ] = self :: satisfies ( $ version , $ requirement ) ; } $ satisfied = ( false === array_search ( false , $ satisfies , true ) ) ; } elseif ( ( $ wildcardPos = strpos ( $ constraint , '.*' ) ) > 0 ) { $ requirement = substr ( $ constraint , 0 , $ wildcardPos + 1 ) ; $ requirements = array ( ">=" . $ requirement , "<" . self :: nextSignificantRelease ( $ requirement ) ) ; $ satisfies = array ( ) ; foreach ( $ requirements as $ requires ) { $ satisfies [ ] = self :: satisfies ( $ version , $ requires ) ; } $ satisfied = ( false === array_search ( false , $ satisfies , true ) ) ; } elseif ( in_array ( substr ( $ constraint , 0 , 1 ) , array ( '<' , '>' , '!' ) ) ) { $ operator = substr ( $ constraint , 0 , 1 ) ; $ versionPos = 1 ; if ( substr ( $ constraint , 1 , 1 ) === '=' ) { $ operator .= substr ( $ constraint , 1 , 1 ) ; $ versionPos ++ ; } $ requirement = substr ( $ constraint , $ versionPos ) ; $ satisfied = version_compare ( $ version , $ requirement , $ operator ) ; } elseif ( $ constraint === '*' ) { $ satisfied = true ; } elseif ( version_compare ( $ version , $ constraint ) === 0 ) { $ satisfied = true ; } return $ satisfied ; }
Test if a version satisfies a version constraint.

@param string $version The version to test.
@param string $constraint The constraint to satisfy.

@return bool TRUE if the version satisfies the constraint; FALSE otherwise.
Test if a version satisfies a version constraint .