Roles   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 29
c 1
b 0
f 0
dl 0
loc 61
rs 10
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getIcon() 0 3 1
A getTitle() 0 3 1
A initialize() 0 2 1
A onDisplay() 0 15 1
A getEditTitle() 0 3 1
A onEdit() 0 20 1
1
<?php
2
3
namespace App\Admin\Sections;
4
5
use AdminColumn;
0 ignored issues
show
Bug introduced by
The type AdminColumn was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use AdminDisplay;
0 ignored issues
show
Bug introduced by
The type AdminDisplay was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use AdminForm;
0 ignored issues
show
Bug introduced by
The type AdminForm was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use AdminFormElement;
0 ignored issues
show
Bug introduced by
The type AdminFormElement was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use SleepingOwl\Admin\Contracts\Initializable;
10
use SleepingOwl\Admin\Form\Buttons\Cancel;
11
//use SleepingOwl\Admin\Form\Buttons\Save;
12
use SleepingOwl\Admin\Form\Buttons\SaveAndClose;
13
use SleepingOwl\Admin\Section;
14
15
class Roles extends Section implements Initializable
16
{
17
    public function initialize()
18
    {
19
    }
20
21
    protected $checkAccess = true;
22
    protected $alias = 'roles';
23
24
    public function getIcon()
25
    {
26
        return 'fas fa-user-shield';
27
    }
28
29
    public function getTitle()
30
    {
31
        return 'Роли';
32
    }
33
34
    public function getEditTitle()
35
    {
36
        return 'Редактирование роли';
37
    }
38
39
    public function onDisplay()
40
    {
41
        $display = AdminDisplay::table()
42
      ->setHtmlAttribute('class', 'table-danger table-hover');
43
44
        $display->setColumns([
45
      AdminColumn::text('id', '#')
46
        ->setWidth('50px')
47
        ->setHtmlAttribute('class', 'text-center'),
48
      AdminColumn::link('name', 'Название')
49
        ->setWidth('150px'),
50
      AdminColumn::text('description', 'Описание'),
51
    ]);
52
53
        return $display;
54
    }
55
56
    public function onEdit($id)
0 ignored issues
show
Unused Code introduced by
The parameter $id is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

56
    public function onEdit(/** @scrutinizer ignore-unused */ $id)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
57
    {
58
        $form = AdminForm::panel()->addBody([
59
      AdminFormElement::text('id', '#')
60
        ->setReadonly(1),
61
      AdminFormElement::text('name', 'Название')
62
        ->required()
63
        ->addValidationRule('max:190', __('adm.valid.max190')),
64
      AdminFormElement::textarea('description', 'Описание')
65
        ->setRows(3)
66
        ->addValidationRule('max:190', __('adm.valid.max190')),
67
    ]);
68
69
        $form->getButtons()->setButtons([
70
      // 'save'  => new Save(),
71
      'save_and_close'  => new SaveAndClose(),
72
      'cancel'          => (new Cancel()),
73
    ]);
74
75
        return $form;
76
    }
77
}
78