Code Duplication    Length = 8-8 lines in 2 locations

AutoTreeTrait.php 2 locations

@@ 94-101 (lines=8) @@
91
    {
92
        /** @var \yii\db\BaseActiveRecord|self $this */
93
        // replace getParents() by getParentsOrdered() if behavior not support ordered query
94
        if ($name === 'parents') {
95
            $this->_autoTreeReturnBehavior = true;
96
            $behavior = $this->getParents();
97
            $this->_autoTreeReturnBehavior = false;
98
            if (method_exists($behavior, 'getParentsOrdered')) {
99
                $this->populateRelation($name, $behavior->getParentsOrdered());
100
            }
101
        }
102
        if ($name === 'descendants') {
103
            $this->_autoTreeReturnBehavior = true;
104
            $behavior = $this->getDescendants();
@@ 102-109 (lines=8) @@
99
                $this->populateRelation($name, $behavior->getParentsOrdered());
100
            }
101
        }
102
        if ($name === 'descendants') {
103
            $this->_autoTreeReturnBehavior = true;
104
            $behavior = $this->getDescendants();
105
            $this->_autoTreeReturnBehavior = false;
106
            if (method_exists($behavior, 'getDescendantsOrdered')) {
107
                $this->populateRelation($name, $behavior->getDescendantsOrdered());
108
            }
109
        }
110
        return parent::__get($name);
111
    }
112