Carts   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 36
loc 36
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 6 6 1
A listExtendQuery() 4 4 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php namespace Bedard\Shop\Controllers;
2
3
use Backend\Classes\Controller;
4
use BackendMenu;
5
6
/**
7
 * Carts Back-end Controller.
8
 */
9 View Code Duplication
class Carts extends Controller
10
{
11
    public $bodyClass = 'compact-container';
12
13
    public $formConfig = 'config_form.yaml';
14
15
    public $implement = [
16
        'Backend.Behaviors.FormController',
17
        'Backend.Behaviors.ListController',
18
        'Owl.Behaviors.ListDelete.Behavior',
19
    ];
20
21
    public $listConfig = 'config_list.yaml';
22
23
    public $registerPermissions = [
24
        'bedard.shop.carts.manage',
25
    ];
26
27
    public function __construct()
28
    {
29
        parent::__construct();
30
31
        BackendMenu::setContext('Bedard.Shop', 'shop', 'carts');
32
    }
33
34
    /**
35
     * Extend the list query.
36
     *
37
     * @param  \Illuminate\Database\Query\Builder $query
38
     * @return \Illuminate\Database\Query\Builder
39
     */
40
    public function listExtendQuery($query)
41
    {
42
        $query->with('statuses');
43
    }
44
}
45