Conditions | 3 |
Paths | 2 |
Total Lines | 21 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
14 | public function attributesToHtml($attributes = null) |
||
15 | { |
||
16 | if(! $attributes) |
||
17 | $attributes = $this->getAttributes(); |
||
18 | |||
19 | $html = ''; |
||
20 | $i = 1; |
||
21 | array_walk($attributes, function ($attr, $k) use (&$html, &$i, $attributes){ |
||
22 | $template = sprintf("%s=\"%s\"", $k, $attr); |
||
23 | |||
24 | if($i == 1){ |
||
25 | $html .= $template; |
||
26 | }else{ |
||
27 | $html .= " " . $template; |
||
28 | } |
||
29 | |||
30 | $i++; |
||
31 | }); |
||
32 | |||
33 | return $html; |
||
34 | } |
||
35 | } |