Code Duplication    Length = 10-10 lines in 2 locations

system/modules/Materials/models/Category.php 1 location

@@ 85-94 (lines=10) @@
82
        }
83
    }
84
85
    public function getRoot() {
86
        $treePath = array_values(array_filter(explode('/', $this->tree_path)));
87
        if (!empty($treePath[0])) {
88
            $category = Category::get($treePath[0]);
89
            if ($category) {
90
                return $category;
91
            }
92
        }
93
        return $this;
94
    }
95
96
    public function getHref() {
97
        $href = !empty(\App::$primary->config['defaultModule']) && \App::$primary->config['defaultModule'] == 'Materials' ? '/category' : '/materials/category';

system/modules/Ecommerce/models/Category.php 1 location

@@ 157-166 (lines=10) @@
154
        ]
155
    ];
156
157
    public function getRoot() {
158
        $treePath = array_values(array_filter(explode('/', $this->tree_path)));
159
        if (!empty($treePath[0])) {
160
            $category = Category::get($treePath[0]);
161
            if ($category) {
162
                return $category;
163
            }
164
        }
165
        return $this;
166
    }
167
168
    public function beforeSave() {
169
        if ($this->id && $this->id == $this->parent_id) {