| Conditions | 2 |
| Paths | 2 |
| Total Lines | 8 |
| Code Lines | 4 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 5 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types=1); |
||
| 26 | 3 | public static function string(int $length = 32): string |
|
| 27 | { |
||
| 28 | 3 | if ($length < 1) { |
|
| 29 | 1 | throw new \InvalidArgumentException('First parameter ($length) must be greater than 0'); |
|
| 30 | } |
||
| 31 | |||
| 32 | 2 | $bytes = random_bytes($length); |
|
| 33 | 2 | return substr(StringHelper::base64UrlEncode($bytes), 0, $length); |
|
| 34 | } |
||
| 36 |