Statuses   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 38
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A listOverrideColumnValue() 0 6 2
1
<?php namespace VojtaSvoboda\Reservations\Controllers;
2
3
use Backend\Classes\Controller;
4
use BackendMenu;
5
use Flash;
6
use VojtaSvoboda\Reservations\Models\Status;
7
8
class Statuses extends Controller
9
{
10
    public $implement = [
11
        'Backend\Behaviors\ListController',
12
        'Backend\Behaviors\FormController',
13
        'Backend\Behaviors\ReorderController',
14
    ];
15
16
    public $listConfig = 'config_list.yaml';
17
    public $formConfig = 'config_form.yaml';
18
    public $reorderConfig = 'config_reorder.yaml';
19
20
    public $requiredPermissions = [
21
        'vojtasvoboda.reservations.statuses',
22
    ];
23
24
    public function __construct()
25
    {
26
        parent::__construct();
27
28
        BackendMenu::setContext('VojtaSvoboda.Reservations', 'reservations', 'statuses');
29
    }
30
31
    /**
32
     * Override displaying status listing.
33
     *
34
     * @param Status $record
35
     * @param string $columnName
36
     *
37
     * @return string
38
     */
39
    public function listOverrideColumnValue($record, $columnName)
40
    {
41
        if ($columnName == 'color') {
42
            return '<div style="width:18px;height:18px;background-color:' . $record->color . '"></div>';
43
        }
44
    }
45
}
46