Passed
Push — master ( 4ada59...3080fc )
by Bruno
09:58
created

Renderable_float::editable()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 17
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
cc 2
eloc 8
c 1
b 1
f 0
nc 2
nop 3
dl 0
loc 17
rs 10
1
<?php declare(strict_types=1);
2
3
namespace Formularium\Frontend\HTMLValidation\Renderable;
4
5
use Formularium\Field;
6
use Formularium\HTMLNode;
7
8
class Renderable_float extends Renderable_number
9
{
10
    public function editable($value, Field $field, HTMLNode $previous): HTMLNode
11
    {
12
        $validators = $field->getValidators();
0 ignored issues
show
Unused Code introduced by
The assignment to $validators is dead and can be removed.
Loading history...
13
        /**
14
         * @var HTMLNode $element
15
         */
16
        $element = $this->getInput($previous);
17
        if (!$element) {
0 ignored issues
show
introduced by
$element is of type Formularium\HTMLNode, thus it always evaluated to true.
Loading history...
18
            return $previous;
19
        }
20
21
        /** @var Datatype_integer $datatype */
22
        $datatype = $field->getDatatype();
0 ignored issues
show
Unused Code introduced by
The assignment to $datatype is dead and can be removed.
Loading history...
23
        $element->setAttribute('min', $field->getValidatorOption(Min::class, 'value', ''));
0 ignored issues
show
Bug introduced by
The type Formularium\Frontend\HTMLValidation\Renderable\Min was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
24
        $element->setAttribute('max', $field->getValidatorOption(Max::class, 'value', ''));
0 ignored issues
show
Bug introduced by
The type Formularium\Frontend\HTMLValidation\Renderable\Max was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
25
26
        return parent::editable($value, $field, $previous);
27
    }
28
}
29