Conditions | 4 |
Paths | 6 |
Total Lines | 24 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 15 |
CRAP Score | 4.0039 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
17 | 1 | public function renderAttributes($overrides = []) |
|
18 | { |
||
19 | 1 | $attribs = $this->getElement()->getAttribs(); |
|
|
|||
20 | 1 | if (!isset($attribs['title'])) { |
|
21 | 1 | $attribs['title'] = $this->getElement()->getLabel(); |
|
22 | } |
||
23 | 1 | $allowedAttribs = $this->getAllowedAttributes(); |
|
24 | 1 | $attribs = array_filter( |
|
25 | 1 | $attribs, |
|
26 | function ($key) use ($allowedAttribs) { |
||
27 | 1 | return $this->canRenderAttribute($key, $allowedAttribs); |
|
28 | 1 | }, |
|
29 | 1 | ARRAY_FILTER_USE_KEY |
|
30 | ); |
||
31 | 1 | $return = ''; |
|
32 | 1 | foreach ($attribs as $name => $value) { |
|
33 | 1 | if (in_array($name, array_keys($overrides))) { |
|
34 | $value = $overrides[$name]; |
||
35 | } |
||
36 | |||
37 | 1 | $return .= ' ' . $name . '="' . $value . '"'; |
|
38 | } |
||
39 | |||
40 | 1 | return $return; |
|
41 | } |
||
68 |