Total Complexity | 3 |
Total Lines | 30 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
16 | class NumericNo0Generator extends NumericGenerator implements GeneratorContract |
||
17 | { |
||
18 | /** |
||
19 | * Generate a numeric token with no zeroes. |
||
20 | * |
||
21 | * @return string |
||
22 | */ |
||
23 | public function generate(): string |
||
24 | { |
||
25 | return (string) str_replace( |
||
26 | 0, |
||
27 | $this->getRandomDigitWithNo0(), |
||
28 | parent::generate() |
||
29 | ); |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * Generate a random digit with no zeroes. |
||
34 | * |
||
35 | * @return int |
||
36 | */ |
||
37 | private function getRandomDigitWithNo0(): int |
||
46 | } |
||
47 | } |
||
48 |