| Conditions | 2 |
| Paths | 2 |
| Total Lines | 12 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 38 | 1 | public function generate() : string |
|
| 39 | { |
||
| 40 | 1 | $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`-=~!@#$%^&*()_+,./<>?;:[]{}\|'; |
|
| 41 | 1 | $password = ''; |
|
| 42 | |||
| 43 | 1 | $max = strlen($chars) - 1; |
|
| 44 | |||
| 45 | 1 | for ($i = 0; $i < $this->length; $i++) { |
|
| 46 | 1 | $password .= $chars[random_int(0, $max)]; |
|
| 47 | } |
||
| 48 | |||
| 49 | 1 | return $password; |
|
| 50 | } |
||
| 52 |