Code Duplication    Length = 3-4 lines in 3 locations

src/Variables/WithName.php 1 location

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

src/Definition/Symbol.php 1 location

@@ 45-48 (lines=4) @@
42
43
    public function __construct($regexp, $binding_power) {
44
        assert('is_string($regexp)');
45
        if (!is_string($regexp) || @preg_match("%$regexp%", "") === false) {
46
            throw new \InvalidArgumentException("Invalid regexp: '%$regexp%'");
47
        }
48
        assert('is_int($binding_power)');
49
        assert('$binding_power >= 0');
50
        $this->regexp = $regexp;
51
        $this->binding_power = $binding_power;

src/Rules/ContainText.php 1 location

@@ 44-46 (lines=3) @@
41
            return false;
42
        }
43
        $regexp = $arguments[0];
44
        if (!is_string($regexp) || @preg_match("%$regexp%", "") === false) {
45
            return false;
46
        }
47
        return true;
48
    }
49