Submit::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 10
cc 2
nc 2
nop 2
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Del\Form\Field;
6
7
class Submit extends FieldAbstract
8
{
9
10 6
    public function getTag(): string
11
    {
12 6
        return 'input';
13
    }
14
15 10
    public function init()
16
    {
17 10
        $this->setAttribute('type', 'submit');
18
    }
19
20
    /**
21
     * Submit constructor.
22
     * @param $name
23
     * @param null $value
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $value is correct as it would always require null to be passed?
Loading history...
24
     */
25 10
    public function __construct(string $name, string $value = null)
26
    {
27 10
        $value = is_null($value) ? $name : $value;
28 10
        parent::__construct($name, $value);
29 10
        $this->setClass('btn btn-primary');
30
    }
31
}
32