Passed
Push — master ( 2802ef...c7d11a )
by Bruno
06:54
created

RenderableBuefyInputTrait   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 32
ccs 0
cts 17
cp 0
rs 10
wmc 5

2 Methods

Rating   Name   Duplication   Size   Complexity  
A viewable() 0 3 1
A _editable() 0 15 4
1
<?php
2
3
namespace Formularium\Frontend\Buefy;
4
5
use Formularium\Field;
6
use Formularium\HTMLElement;
7
8
trait RenderableBuefyInputTrait
9
{
10
    use RenderableBuefyTrait;
11
12
    public function viewable($value, Field $field, HTMLElement $previous): HTMLElement
0 ignored issues
show
Unused Code introduced by
The parameter $field is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

12
    public function viewable($value, /** @scrutinizer ignore-unused */ Field $field, HTMLElement $previous): HTMLElement

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $value is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

12
    public function viewable(/** @scrutinizer ignore-unused */ $value, Field $field, HTMLElement $previous): HTMLElement

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
13
    {
14
        return $previous;
15
    }
16
17
    /**
18
     * Subcall of wrapper editable() from RenderableMaterializeTrait
19
     *
20
     * @param mixed $value
21
     * @param Field $field
22
     * @param HTMLElement $previous
23
     * @return HTMLElement
24
     */
25
    public function _editable($value, Field $field, HTMLElement $previous): HTMLElement
0 ignored issues
show
Unused Code introduced by
The parameter $field is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

25
    public function _editable($value, /** @scrutinizer ignore-unused */ Field $field, HTMLElement $previous): HTMLElement

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $value is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

25
    public function _editable(/** @scrutinizer ignore-unused */ $value, Field $field, HTMLElement $previous): HTMLElement

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
26
    {
27
        // add extra classes
28
        $previous->walk(
29
            function ($e) {
30
                if ($e instanceof HTMLElement) {
31
                    if ($e->getTag() === 'input') {
32
                        $e->setTag('b-input');
33
                    } elseif ($e->getTag() === 'select') {
34
                        $e->setTag('b-select');
35
                    }
36
                }
37
            }
38
        );
39
        return $previous;
40
    }
41
}
42