Code Duplication    Length = 9-10 lines in 3 locations

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

@@ 79-88 (lines=10) @@
76
        }
77
    }
78
79
    public function resolveViewer() {
80
        if ($this->viewer !== 'inherit') {
81
            return $this->viewer;
82
        } elseif ($this->viewer == 'inherit' && $this->category) {
83
            return $this->category->resolveViewer(true);
84
        } else {
85
            return (!empty(App::$cur->ecommerce->config['defaultCategoryView']) ? App::$cur->ecommerce->config['defaultCategoryView'] : 'itemList');
86
        }
87
    }
88
89
}
90

system/modules/Ecommerce/models/Category.php 2 locations

@@ 181-189 (lines=9) @@
178
        }
179
    }
180
181
    public function resolveTemplate() {
182
        if ($this->template !== 'inherit') {
183
            return $this->template;
184
        } elseif ($this->template == 'inherit' && $this->category) {
185
            return $this->category->resolveTemplate(true);
186
        } else {
187
            return (!empty(\App::$cur->ecommerce->config['defaultCategoryTemplate']) ? \App::$cur->ecommerce->config['defaultCategoryTemplate'] : 'current');
188
        }
189
    }
190
191
    public function resolveViewer() {
192
        if ($this->viewer !== 'inherit') {
@@ 191-200 (lines=10) @@
188
        }
189
    }
190
191
    public function resolveViewer() {
192
        if ($this->viewer !== 'inherit') {
193
            return $this->viewer;
194
        } elseif ($this->viewer == 'inherit' && $this->category) {
195
            return $this->category->resolveViewer(true);
196
        } else {
197
            return (!empty(\App::$cur->ecommerce->config['defaultCategoryView']) ? \App::$cur->ecommerce->config['defaultCategoryView'] : 'itemList');
198
        }
199
    }
200
201
    public function calcItemsCount($save = true) {
202
        $count = \App::$cur->Ecommerce->getItemsCount(['parent' => $this->id]);
203
        $this->items_count = $count;