Passed
Push — 5.x ( ea5ddf...a12a6d )
by Enjoys
01:06 queued 12s
created

Submit   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 83.33%

Importance

Changes 0
Metric Value
wmc 3
eloc 7
dl 0
loc 12
ccs 5
cts 6
cp 0.8333
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 3
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