Code Duplication    Length = 10-12 lines in 2 locations

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

@@ 696-705 (lines=10) @@
693
        $regex  = '/'.preg_quote($text, '/').'/ui';
694
695
        if(trim($negate)) {
696
            if (preg_match($regex, $actual)) {
697
                $message = sprintf(
698
                    'The text "%s" was found in the text of the "%s" region on the page %s.',
699
                    $text,
700
                    $region,
701
                    $this->getSession()->getCurrentUrl()
702
                );
703
704
                throw new \Exception($message);
705
            }
706
        } else {
707
            if (!preg_match($regex, $actual)) {
708
                $message = sprintf(
@@ 706-717 (lines=12) @@
703
704
                throw new \Exception($message);
705
            }
706
        } else {
707
            if (!preg_match($regex, $actual)) {
708
                $message = sprintf(
709
                    'The text "%s" was not found anywhere in the text of the "%s" region on the page %s.',
710
                    $text,
711
                    $region,
712
                    $this->getSession()->getCurrentUrl()
713
                );
714
715
                throw new \Exception($message);
716
            }
717
        }
718
719
    }
720