function Constraint::isCompatible

Same name in other branches
  1. 8.9.x core/lib/Drupal/Component/Version/Constraint.php \Drupal\Component\Version\Constraint::isCompatible()
  2. 10 core/lib/Drupal/Component/Version/Constraint.php \Drupal\Component\Version\Constraint::isCompatible()
  3. 11.x core/lib/Drupal/Component/Version/Constraint.php \Drupal\Component\Version\Constraint::isCompatible()

Determines if the provided version is satisfied by this constraint.

Parameters

string $version: The version to check, for example '4.2'.

Return value

bool TRUE if the provided version is satisfied by this constraint, FALSE if not.

File

core/lib/Drupal/Component/Version/Constraint.php, line 64

Class

Constraint
A value object representing a Drupal version constraint.

Namespace

Drupal\Component\Version

Code

public function isCompatible($version) {
    foreach ($this->constraintArray as $constraint) {
        if (!version_compare($version, $constraint['version'], $constraint['op'])) {
            return FALSE;
        }
    }
    return TRUE;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.