Conditions | 8 |
Paths | 1 |
Total Lines | 35 |
Code Lines | 25 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 72 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
26 | public function _editable($value, Field $field, HTMLElement $previous): HTMLElement |
||
27 | { |
||
28 | // add extra classes |
||
29 | $previous->walk( |
||
30 | function ($e) use ($field) { |
||
31 | if ($e instanceof HTMLElement) { |
||
32 | if ($e->getTag() === 'input') { |
||
33 | if (($e->getAttribute('type')[0] ?? '') === 'radio') { |
||
34 | $e->setTag('b-radio') |
||
35 | ->setAttribute('native-value', $e->getAttribute('value')) |
||
36 | ->setContent($e->getAttribute('title')); |
||
37 | } else { |
||
38 | $e->setTag('b-input'); |
||
39 | } |
||
40 | } elseif ($e->getTag() === 'select') { |
||
41 | $e->setTag('b-select'); |
||
42 | } elseif ($e->getTag() === 'textarea') { |
||
43 | $e->setTag('b-input')->setAttribute('type', 'textarea'); |
||
44 | } else { |
||
45 | return; |
||
46 | } |
||
47 | |||
48 | $size = $field->getExtension(Renderable::SIZE, ''); |
||
49 | switch ($size) { |
||
50 | case Renderable::SIZE_LARGE: |
||
51 | $e->addAttribute('size', 'is-large'); |
||
52 | break; |
||
53 | case Renderable::SIZE_SMALL: |
||
54 | $e->addAttribute('size', 'is-small'); |
||
55 | break; |
||
56 | } |
||
57 | } |
||
58 | } |
||
59 | ); |
||
60 | return $previous; |
||
61 | } |
||
63 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.