Passed
Push — master ( 567445...4ac224 )
by Costin
02:45
created

Submit   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 3
Bugs 1 Features 1
Metric Value
wmc 5
eloc 7
c 3
b 1
f 1
dl 0
loc 21
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setLabel() 0 6 3
A attributesList() 0 4 1
A setStyles() 0 3 1
1
<?php
2
3
namespace SoareCostin\BladeFormComponents\FormElements;
4
5
use SoareCostin\BladeFormComponents\FormElement;
6
7
class Submit extends FormElement
8
{
9
    protected function attributesList()
10
    {
11
        return [
12
            'class', 'disabled',
13
        ];
14
    }
15
16
    protected function setLabel()
17
    {
18
        parent::setLabel();
19
20
        if (empty($this->label)) {
21
            $this->label = is_null($this->model) ? 'Create' : 'Edit';
22
        }
23
    }
24
25
    protected function setStyles()
26
    {
27
        $this->class[] = config('blade-form-components.themes.'.$this->getTheme().'.fields.submit');
28
    }
29
}
30