Code Duplication    Length = 10-12 lines in 2 locations

src/SilverStripe/BehatExtension/Context/BasicContext.php 2 locations

@@ 754-763 (lines=10) @@
751
        $regex  = '/'.preg_quote($text, '/').'/ui';
752
753
        if (trim($negate)) {
754
            if (preg_match($regex, $actual)) {
755
                $message = sprintf(
756
                    'The text "%s" was found in the text of the "%s" region on the page %s.',
757
                    $text,
758
                    $region,
759
                    $this->getSession()->getCurrentUrl()
760
                );
761
762
                throw new \Exception($message);
763
            }
764
        } else {
765
            if (!preg_match($regex, $actual)) {
766
                $message = sprintf(
@@ 764-775 (lines=12) @@
761
762
                throw new \Exception($message);
763
            }
764
        } else {
765
            if (!preg_match($regex, $actual)) {
766
                $message = sprintf(
767
                    'The text "%s" was not found anywhere in the text of the "%s" region on the page %s.',
768
                    $text,
769
                    $region,
770
                    $this->getSession()->getCurrentUrl()
771
                );
772
773
                throw new \Exception($message);
774
            }
775
        }
776
    }
777
778
    /**