/** * @param string $constraintStringUnit * @return Constraint */ protected function buildConstraintFromStringUnit($constraintStringUnit) { list($operator, $operandString) = array_values($this->parseConstraintStringUnit($constraintStringUnit)); if (empty($operandString)) { $this->error(); } try { return Constraint::fromProperties($operator ?: Constraint::OPERATOR_EQ, Version::fromString($operandString)); } catch (Exception $ex) { $this->error(); } }
/** * @param ConstraintInterface|string $constraint * @return bool */ public function matches($constraint) { if (!$constraint instanceof ConstraintInterface) { $constraint = Constraint::fromString($constraint); } return $constraint->assert($this); }