Conditions | 6 |
Paths | 4 |
Total Lines | 35 |
Code Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Changes | 6 | ||
Bugs | 2 | Features | 1 |
1 | <?php |
||
7 | public function glueAttributes($attributesList = null) |
||
8 | { |
||
9 | if (is_null($attributesList)) { |
||
10 | $attributesList = $this->attributesList(); |
||
11 | } |
||
12 | |||
13 | $pairs = collect($attributesList)->filter(function ($attr, $key) { |
||
|
|||
14 | return isset($this->{$attr}); |
||
15 | }) |
||
16 | ->filter(function ($attr, $key) { |
||
17 | return ! is_bool($this->{$attr}) || $this->{$attr} == true; |
||
18 | }) |
||
19 | ->map(function ($attr, $key) { |
||
20 | if (is_array($this->{$attr})) { |
||
21 | return sprintf('%s="%s"', $attr, implode(' ', $this->{$attr})); |
||
22 | } |
||
23 | |||
24 | if (is_bool($this->{$attr})) { |
||
25 | return $attr; |
||
26 | } |
||
27 | |||
28 | return sprintf('%s="%s"', $attr, $this->{$attr}); |
||
29 | }); |
||
30 | |||
31 | $customAttributes = $this->customAttributes(); |
||
32 | |||
33 | if (! empty($customAttributes)) { |
||
34 | $pairs = $pairs->merge( |
||
35 | collect($customAttributes)->map(function ($attr, $key) { |
||
36 | return sprintf('%s="%s"', $key, $attr); |
||
37 | }) |
||
38 | ); |
||
39 | } |
||
40 | |||
41 | return $pairs->implode(' '); |
||
42 | } |
||
54 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.