EmailTemplatesController::cbInit()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 63
Code Lines 53

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 53
dl 0
loc 63
rs 9.0254
c 1
b 0
f 0
cc 1
nc 1
nop 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php namespace crocodicstudio\crudbooster\controllers;
2
3
use CRUDBooster;
0 ignored issues
show
Bug introduced by
The type CRUDBooster 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...
4
use Illuminate\Support\Facades\Excel;
0 ignored issues
show
Bug introduced by
The type Illuminate\Support\Facades\Excel 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...
5
use Illuminate\Support\Facades\PDF;
0 ignored issues
show
Bug introduced by
The type Illuminate\Support\Facades\PDF 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
7
class EmailTemplatesController extends \crocodicstudio\crudbooster\controllers\CBController
8
{
9
    public function cbInit()
10
    {
11
        $this->table = "cms_email_templates";
12
        $this->primary_key = "id";
13
        $this->title_field = "name";
14
        $this->limit = 20;
15
        $this->orderby = ["id" => "desc"];
16
        $this->global_privilege = false;
17
18
        $this->button_table_action = true;
19
        $this->button_action_style = "button_icon";
20
        $this->button_add = true;
21
        $this->button_delete = true;
22
        $this->button_edit = true;
23
        $this->button_detail = true;
24
        $this->button_show = true;
25
        $this->button_filter = true;
26
        $this->button_export = false;
27
        $this->button_import = false;
28
29
        $this->col = [];
30
        $this->col[] = ["label" => "Template Name", "name" => "name"];
31
        $this->col[] = ["label" => "Slug", "name" => "slug"];
32
33
        $this->form = [];
34
        $this->form[] = [
35
            "label" => "Template Name",
36
            "name" => "name",
37
            "type" => "text",
38
            "required" => true,
39
            "validation" => "required|min:3|max:255|alpha_spaces",
40
            "placeholder" => "You can only enter the letter only",
41
        ];
42
        $this->form[] = ["label" => "Slug", "type" => "text", "name" => "slug", "required" => true, 'validation' => 'required|unique:cms_email_templates,slug'];
43
        $this->form[] = ["label" => "Subject", "name" => "subject", "type" => "text", "required" => true, "validation" => "required|min:3|max:255"];
44
        $this->form[] = ["label" => "Content", "name" => "content", "type" => "wysiwyg", "required" => true, "validation" => "required"];
45
        $this->form[] = ["label" => "Description", "name" => "description", "type" => "text", "required" => true, "validation" => "required|min:3|max:255"];
46
47
        $this->form[] = [
48
            "label" => "From Name",
49
            "name" => "from_name",
50
            "type" => "text",
51
            "required" => false,
52
            "width" => "col-sm-6",
53
            'placeholder' => 'Optional',
54
        ];
55
        $this->form[] = [
56
            "label" => "From Email",
57
            "name" => "from_email",
58
            "type" => "email",
59
            "required" => false,
60
            "validation" => "email",
61
            "width" => "col-sm-6",
62
            'placeholder' => 'Optional',
63
        ];
64
65
        $this->form[] = [
66
            "label" => "Cc Email",
67
            "name" => "cc_email",
68
            "type" => "email",
69
            "required" => false,
70
            "validation" => "email",
71
            'placeholder' => 'Optional',
72
        ];
73
    }
74
    //By the way, you can still create your own method in here... :)
75
76
}
77