| Conditions | 4 |
| Paths | 6 |
| Total Lines | 25 |
| Code Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php declare(strict_types=1); |
||
| 12 | public function render(array $parameters, HTMLNode $previous): HTMLNode |
||
| 13 | { |
||
| 14 | $btnClass = 'btn'; |
||
| 15 | $size = $parameters[self::SIZE] ?? ''; |
||
| 16 | switch ($size) { |
||
| 17 | case self::SIZE_LARGE: |
||
| 18 | $btnClass = 'btn-large'; |
||
| 19 | break; |
||
| 20 | case self::SIZE_SMALL: |
||
| 21 | $btnClass = 'btn-small'; |
||
| 22 | break; |
||
| 23 | } |
||
| 24 | $previous->addAttribute('class', "$btnClass waves-effect waves-light"); |
||
| 25 | |||
| 26 | $icon = $parameters[self::ICON] ?? ''; |
||
| 27 | if ($icon) { |
||
| 28 | $iconElement = HTMLNode::factory( |
||
| 29 | 'i', |
||
| 30 | [ 'class' => "material-icons left" ], |
||
| 31 | $icon |
||
| 32 | ); |
||
| 33 | $previous->prependContent($iconElement); |
||
| 34 | } |
||
| 35 | |||
| 36 | return $previous; |
||
| 37 | } |
||
| 45 |