GemberPHP /
event-sourcing
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace Gember\EventSourcing\Util\String; |
||
| 6 | |||
| 7 | final readonly class ClassNameSegmentHelper |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @param class-string $className |
||
| 11 | */ |
||
| 12 | 8 | public static function getLastSegment(string $className): string |
|
| 13 | { |
||
| 14 | 8 | if (!str_contains($className, '\\')) { |
|
| 15 | 1 | return $className; |
|
| 16 | } |
||
| 17 | |||
| 18 | 7 | return substr($className, strrpos($className, '\\') + 1); |
|
| 19 | } |
||
| 20 | } |
||
| 21 |