You are here

public function Constraint::__construct in Zircon Profile 8

Same name in this branch
  1. 8 vendor/symfony/validator/Constraint.php \Symfony\Component\Validator\Constraint::__construct()
  2. 8 vendor/composer/semver/src/Constraint/Constraint.php \Composer\Semver\Constraint\Constraint::__construct()
Same name and namespace in other branches
  1. 8.0 vendor/composer/semver/src/Constraint/Constraint.php \Composer\Semver\Constraint\Constraint::__construct()

Sets operator and version to compare with.

Parameters

string $operator:

string $version:

Throws

\InvalidArgumentException if invalid operator is given.

File

vendor/composer/semver/src/Constraint/Constraint.php, line 81

Class

Constraint
Defines a constraint.

Namespace

Composer\Semver\Constraint

Code

public function __construct($operator, $version) {
  if (!isset(self::$transOpStr[$operator])) {
    throw new \InvalidArgumentException(sprintf('Invalid operator "%s" given, expected one of: %s', $operator, implode(', ', self::getSupportedOperators())));
  }
  $this->operator = self::$transOpStr[$operator];
  $this->version = $version;
}