strangebuzz /
MicroSymfony
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace App\Helper; |
||
| 6 | |||
| 7 | use Symfony\Component\String\Slugger\SluggerInterface; |
||
| 8 | |||
| 9 | /** |
||
| 10 | * This is a simple service just to create a unit test example. |
||
| 11 | * |
||
| 12 | * @see StringHelperTest |
||
| 13 | */ |
||
| 14 | final readonly class StringHelper |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 15 | { |
||
| 16 | 19 | public function __construct( |
|
| 17 | private SluggerInterface $slugger, |
||
| 18 | ) { |
||
| 19 | 19 | } |
|
| 20 | |||
| 21 | 7 | public function slugify(?string $string): string |
|
| 22 | { |
||
| 23 | 7 | return $this->slugger->slug((string) $string)->lower()->toString(); |
|
| 24 | } |
||
| 25 | } |
||
| 26 |