Image::__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 Enjoys\Forms\Elements;
6
7
use Enjoys\Forms\AttributeFactory;
8
use Enjoys\Forms\Element;
9
10
class Image extends Element
11
{
12
    protected string $type = 'image';
13
14 3
    public function __construct(string $name, ?string $src = null)
15
    {
16 3
        parent::__construct($name);
17 3
        if (!is_null($src)) {
18 1
            $this->setAttribute(AttributeFactory::create('src', $src));
19
        }
20
    }
21
}
22