| Conditions | 6 |
| Paths | 7 |
| Total Lines | 22 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 25 | public static function getHash() |
||
| 26 | { |
||
| 27 | $newHash = ''; |
||
| 28 | //0-9, A-Z, a-z |
||
| 29 | $allowedRanges = [[48, 57], [65, 90], [97, 122]]; |
||
| 30 | $rangeCount = \count($allowedRanges); |
||
| 31 | for ($i = 0; $i < static::HASH_LENGTH; ++$i) { |
||
| 32 | $rand = mt_rand(20, 160); |
||
| 33 | $allowed = false; |
||
| 34 | for ($j = 0; $j < $rangeCount; ++$j) { |
||
| 35 | if ($allowedRanges[$j][0] <= $rand && $allowedRanges[$j][1] >= $rand) { |
||
| 36 | $allowed = true; |
||
| 37 | } |
||
| 38 | } |
||
| 39 | if ($allowed) { |
||
| 40 | $newHash .= \chr($rand); |
||
| 41 | } else { |
||
| 42 | --$i; |
||
| 43 | } |
||
| 44 | } |
||
| 45 | |||
| 46 | return $newHash; |
||
| 47 | } |
||
| 96 |