Code Duplication    Length = 6-8 lines in 2 locations

Parser/ContextualToken.php 2 locations

@@ 51-56 (lines=6) @@
48
        $start = !in_array($this->name, $context, false);
49
50
        if ($start) {
51
            if (!$this->getRule()->validateContext($context)) {
52
                $this->setValid(false);
53
            } else {
54
                $this->_valid = true;
55
                $this->_end->_valid = false;
56
            }
57
        } else {
58
            if (!$this->getRule()->validateContext($context, [$this->name => Rule::CONTEXT_IN])) {
59
                $this->setValid(false);
@@ 57-64 (lines=8) @@
54
                $this->_valid = true;
55
                $this->_end->_valid = false;
56
            }
57
        } else {
58
            if (!$this->getRule()->validateContext($context, [$this->name => Rule::CONTEXT_IN])) {
59
                $this->setValid(false);
60
            } else {
61
                $this->_valid = false;
62
                $this->_end->_valid = true;
63
            }
64
        }
65
66
        $this->_end->_start = null;
67
        $this->_end = null;