Completed
Push — master ( b5f959...da0e5f )
by Costin
02:20
created

Submit   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 22
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 22
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setDefaultClass() 0 4 1
A setLabel() 0 6 3
A attributesList() 0 4 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 (is_null($this->label)) {
0 ignored issues
show
introduced by
The condition is_null($this->label) is always false.
Loading history...
21
            $this->label = is_null($this->model) ? 'Create' : 'Edit';
22
        }
23
    }
24
25
    protected function setDefaultClass()
26
    {
27
        // Specific to Bootstrap, we need to add it to config
28
        $this->class[] = 'btn btn-primary';
29
    }
30
}
31