| 1 |
<?php |
| 2 |
|
| 3 |
namespace SimpleAnalytics\Support; |
| 4 |
|
| 5 |
class SvgIcon |
| 6 |
{ |
| 7 |
/** |
| 8 |
* @var string |
| 9 |
*/ |
| 10 |
protected $icon; |
| 11 |
/** |
| 12 |
* @var mixed[] |
| 13 |
*/ |
| 14 |
protected $attributes = []; |
| 15 |
public function __construct(string $icon) |
| 16 |
{ |
| 17 |
$this->icon = $icon; |
| 18 |
} |
| 19 |
public function class(string $class): self |
| 20 |
{ |
| 21 |
$this->attributes['class'] = $class; |
| 22 |
|
| 23 |
return $this; |
| 24 |
} |
| 25 |
public function __toString(): string |
| 26 |
{ |
| 27 |
return str_replace('<svg', '<svg ' . Str::htmlAttributes($this->attributes), $this->icon); |
| 28 |
} |
| 29 |
} |
| 30 |
|