You are here

public function Constraint::isCompatible in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Component/Version/Constraint.php \Drupal\Component\Version\Constraint::isCompatible()
  2. 9 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;
}