Code Duplication    Length = 6-8 lines in 2 locations

Parser/Token/ContextualToken.php 2 locations

@@ 39-44 (lines=6) @@
36
        $start = !in_array($this->name, $context, false);
37
38
        if ($start) {
39
            if (!$this->getRule()->validate($context)) {
40
                $this->setValid(false);
41
            } else {
42
                $this->_valid       = true;
43
                $this->_end->_valid = false;
44
            }
45
        } else {
46
            if (!$this->getRule()->validate($context, [$this->name => Rule::CONTEXT_IN])) {
47
                $this->setValid(false);
@@ 45-52 (lines=8) @@
42
                $this->_valid       = true;
43
                $this->_end->_valid = false;
44
            }
45
        } else {
46
            if (!$this->getRule()->validate($context, [$this->name => Rule::CONTEXT_IN])) {
47
                $this->setValid(false);
48
            } else {
49
                $this->_valid       = false;
50
                $this->_end->_valid = true;
51
            }
52
        }
53
54
        $this->_end->_start = false;
55
        $this->_end         = false;