diff --git a/src/SequenceMatcher.php b/src/SequenceMatcher.php index 1b74649..92d6992 100644 --- a/src/SequenceMatcher.php +++ b/src/SequenceMatcher.php @@ -99,6 +99,7 @@ final class SequenceMatcher 'ignoreCase' => false, 'ignoreLineEnding' => false, 'ignoreWhitespace' => false, + 'lengthLimit' => 2000, ]; /** @@ -138,7 +139,7 @@ public function setOptions(array $options): self $needRerunChainB = $this->isAnyOptionChanged( $this->options, $options, - ['ignoreCase', 'ignoreLineEnding', 'ignoreWhitespace'] + ['ignoreCase', 'ignoreLineEnding', 'ignoreWhitespace', 'lengthLimit'] ); $this->options = $options + self::$defaultOptions; @@ -680,7 +681,7 @@ private function chainB(): self $this->b2j[$char] = $this->b2j[$char] ?? []; if ( - $length >= 1000 + $length >= $this->options['lengthLimit'] && \count($this->b2j[$char]) * 100 > $length && $char !== self::APPENDED_HELPER_LINE ) {