Code Duplication    Length = 3-4 lines in 2 locations

src/Rules/ContainText.php 1 location

@@ 36-39 (lines=4) @@
33
                "One argument is required when using a contain text.");
34
        }
35
        $regexp = $arguments[0];
36
        if (!is_string($regexp) || @preg_match("%$regexp%", "") === false) {
37
            throw new \InvalidArgumentException(
38
                "Invalid regexp '$regexp' when using contain text.");
39
        }
40
    }
41
42
    /**

src/Variables/WithName.php 1 location

@@ 29-31 (lines=3) @@
26
27
    public function __construct($regexp, Variable $other) {
28
        parent::__construct($other->name());
29
        if (!is_string($regexp) || @preg_match("%$regexp%", "") === false) {
30
            throw new \InvalidArgumentException("Invalid regexp: '%regexp'");
31
        }
32
        $this->regexp = $regexp;
33
        $this->other = $other;
34
    }