Passed
Push — master ( 34f20f...a12a6d )
by Enjoys
57s queued 12s
created

Submit::__construct()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 3.0416

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 8
ccs 5
cts 6
cp 0.8333
rs 10
c 0
b 0
f 0
cc 3
nc 4
nop 2
crap 3.0416
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Enjoys\Forms\Elements;
6
7
use Enjoys\Forms\AttributeFactory;
8
use Enjoys\Forms\Element;
9
10
class Submit extends Element
11
{
12
    protected string $type = 'submit';
13
14 3
    public function __construct(string $name = null, string $title = null)
15
    {
16 3
        if (is_null($name)){
17
            $name = uniqid('submit');
18
        }
19 3
        parent::__construct($name, $title);
20 3
        if (!is_null($title)) {
21 3
            $this->setAttribute(AttributeFactory::create('value', $title));
22
        }
23
    }
24
}
25