Renderable_float   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 2
eloc 8
c 1
b 1
f 0
dl 0
loc 17
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A editable() 0 15 2
1
<?php declare(strict_types=1);
2
3
namespace Formularium\Frontend\HTMLValidation\Renderable;
4
5
use Formularium\Field;
6
use Formularium\HTMLNode;
7
use Formularium\Validator\Max;
8
use Formularium\Validator\Min;
9
10
class Renderable_float extends Renderable_number
11
{
12
    public function editable($value, Field $field, HTMLNode $previous): HTMLNode
13
    {
14
        $validators = $field->getValidators();
0 ignored issues
show
Unused Code introduced by
The assignment to $validators is dead and can be removed.
Loading history...
15
        /**
16
         * @var HTMLNode|null $element
17
         */
18
        $element = $this->getInput($previous);
19
        if (!$element) {
20
            return $previous;
21
        }
22
23
        $element->setAttribute('min', $field->getValidatorOption(Min::class, 'value', ''));
24
        $element->setAttribute('max', $field->getValidatorOption(Max::class, 'value', ''));
25
26
        return parent::editable($value, $field, $previous);
27
    }
28
}
29