Code Duplication    Length = 6-8 lines in 2 locations

Parser/ContextualToken.php 2 locations

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