Passed
Push — master ( 3020a3...ce74a0 )
by Bruno
08:42
created

Renderable_relationship::viewable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 3
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace Modelarium\Frontend\Bulma\Renderable;
4
5
use Formularium\Field;
6
use Formularium\Renderable;
7
use Formularium\Frontend\Bulma\RenderableBulmaTrait;
8
use Formularium\HTMLNode;
9
10
class Renderable_relationship extends Renderable
11
{
12
    use RenderableBulmaTrait;
13
    
14
    public function viewable($value, Field $field, HTMLNode $previous): HTMLNode
15
    {
16
        return $previous;
17
    }
18
19
    /**
20
     * Subcall of wrapper editable() from RenderableMaterializeTrait
21
     *
22
     * @param mixed $value
23
     * @param Field $field
24
     * @param HTMLNode $previous
25
     * @return HTMLNode
26
     */
27
    public function _editable($value, Field $field, HTMLNode $previous): HTMLNode
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

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

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

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

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...
28
    {
29
        // create a div around the old select
30
        $oldSelect = $previous->get('select')[0];
31
        $newSelect = clone $oldSelect;
32
        $oldSelect->setTag('div')->setAttribute('class', 'select')->setContent($newSelect);
33
34
        foreach ($previous->getContent() as $e) {
35
            if ($e->getAttribute('class') === ['formularium-comment']) {
36
                $e->setTag('p')->setAttributes([
37
                    'class' => 'help',
38
                ]);
39
            }
40
        }
41
42
        return $previous;
43
    }
44
}
45