| Conditions | 2 |
| Paths | 2 |
| Total Lines | 9 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | function generateRandomShortCode(int $length = 5): string |
||
| 10 | { |
||
| 11 | static $shortIdFactory; |
||
| 12 | if ($shortIdFactory === null) { |
||
| 13 | $shortIdFactory = new ShortIdFactory(); |
||
| 14 | } |
||
| 15 | |||
| 16 | $alphabet = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; |
||
| 17 | return $shortIdFactory->generate($length, $alphabet)->serialize(); |
||
| 18 | } |
||
| 19 |