Yassine Doghri b6114d3d93 chore: update rector to latest and use parallel for faster processing
update composer dependencies to latest
2022-09-28 14:00:46 +00:00

29 lines
588 B
PHP

<?php
declare(strict_types=1);
namespace App\Views\Components;
use Exception;
use ViewComponents\Component;
class Icon extends Component
{
public string $glyph = '';
public function render(): string
{
try {
$svgContents = file_get_contents('assets/icons/' . $this->glyph . '.svg');
} catch (Exception) {
return '□';
}
if ($this->attributes['class'] !== '') {
return str_replace('<svg', '<svg class="' . $this->attributes['class'] . '"', $svgContents);
}
return $svgContents;
}
}