EmailForm   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
eloc 34
dl 0
loc 49
ccs 0
cts 37
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A buildForm() 0 38 1
1
<?php namespace Distilleries\Expendable\Http\Forms\Email;
2
3
use Distilleries\Expendable\Helpers\StaticLabel;
4
use Distilleries\FormBuilder\FormValidator;
5
6
class EmailForm extends FormValidator {
7
8
    public static $rules = [
9
        'libelle'   => 'required',
10
        'body_type' => 'required',
11
        'action'    => 'required',
12
        'status'    => 'required|integer'
13
    ];
14
15
    // ------------------------------------------------------------------------------------------------
16
17
    public function buildForm()
18
    {
19
20
        $this
21
            ->add($this->model->getKeyName(), 'hidden')
22
            ->add('libelle', 'text', [
23
                'validation' => 'required',
24
                'label'      => trans('expendable::form.subject')
25
            ])
26
            ->add('body_type', 'choice', [
27
                'choices'     => StaticLabel::bodyType(),
28
                'empty_value' => '-',
29
                'validation'  => 'required',
30
                'label'       => trans('expendable::form.body_type')
31
            ])
32
            ->add('action', 'choice', [
33
                'choices'     => StaticLabel::mailActions(),
34
                'empty_value' => '-',
35
                'validation'  => 'required',
36
                'label'       => trans('expendable::form.action')
37
            ])
38
            ->add('cc', 'tag', [
39
                'label' => trans('expendable::form.cc')
40
            ])
41
            ->add('bcc', 'tag', [
42
                'label' => trans('expendable::form.bcc')
43
            ])
44
            ->add('content', 'tinymce', [
45
                'validation' => 'required',
46
                'label'      => trans('expendable::form.content')
47
            ])
48
            ->add('status', 'choice', [
49
                'choices'     => StaticLabel::status(),
50
                'empty_value' => '-',
51
                'validation'  => 'required',
52
                'label'       => trans('expendable::form.status')
53
            ])
54
            ->addDefaultActions();
55
    }
56
}