='], * [ '2.0.0', '<'] * ) * ``` * * ...mean: "assert that the given $version is greater than or equal 1.0.0 AND strictly less than 2.0.0" * * To express OR conditions, make multiple calls to this function and OR the results together in your own code. * * @link http://php.net/manual/en/function.version-compare.php * @param string $version * @param array $constraints * @ignore * @internal * @throws ClientPreferencesSchemaException * @return bool */ public static function version_satisfies( $version, $constraints ) { $valid_operators = array( '<', 'lt', '<=', 'le', '>', 'gt', '>=', 'ge', '==', '=', 'eq', '!=', '<>', 'ne' ); if ( ! is_array( $constraints ) ) { throw new ClientPreferencesSchemaException(); } $result_so_far = true; foreach ( $constraints as $constraint ) { if ( ! is_array( $constraint ) || 2 !== count( $constraint ) || false === array_search( $constraint[1], $valid_operators, true ) ) { throw new ClientPreferencesSchemaException(); } if ( ! version_compare( $version, $constraint[0], $constraint[1] ) ) { $result_so_far = false; break; } } return $result_so_far; } }