/** * @param ValuesBag $valuesBag * @param ValueComparisonInterface $comparison * @param array $options */ private function removeDuplicateMatchers(ValuesBag $valuesBag, ValueComparisonInterface $comparison, array $options) { /** @var PatternMatch[] $matchers */ $matchers = $valuesBag->get(PatternMatch::class); foreach ($matchers as $i => $value) { foreach ($matchers as $c => $value2) { if ($i === $c) { continue; } if ($value->isCaseInsensitive() === $value2->isCaseInsensitive() && $value->getType() === $value2->getType() && $comparison->isEqual($value->getValue(), $value2->getValue(), $options)) { $valuesBag->remove(PatternMatch::class, $i); unset($matchers[$i]); } } } }
private function isBoundEqual(ValueComparisonInterface $comparison, $options, $value1, $value2, $value1Inclusive, $value2Inclusive) { if (!$comparison->isEqual($value1, $value2, $options)) { return false; } if ($value1Inclusive === $value2Inclusive) { return true; } return true === $value1Inclusive; }