Code Duplication    Length = 12-12 lines in 2 locations

src/Token/TokenGenerator/NumericNo0TokenGenerator.php 1 location

@@ 9-20 (lines=12) @@
6
7
final class NumericNo0TokenGenerator extends NumericTokenGenerator implements TokenGeneratorInterface
8
{
9
    protected function getPlainText($length)
10
    {
11
        $range = $this->generateRangeForLength($length);
12
13
        try {
14
            $int = random_int($range[0], $range[1]);
15
        } catch (Exception $e) {
16
            $int = rand($range[0], $range[1]);
17
        }
18
19
        return (string) str_replace(0, $this->getRandomDigitWithNo0(), (string) $int);
20
    }
21
22
    private function getRandomDigitWithNo0()
23
    {

src/Token/TokenGenerator/NumericTokenGenerator.php 1 location

@@ 9-20 (lines=12) @@
6
7
class NumericTokenGenerator extends AbstractTokenGenerator implements TokenGeneratorInterface
8
{
9
    protected function getPlainText($length)
10
    {
11
        $range = $this->generateRangeForLength($length);
12
13
        try {
14
            $int = random_int($range[0], $range[1]);
15
        } catch (Exception $e) {
16
            $int = rand($range[0], $range[1]);
17
        }
18
19
        return (string) $int;
20
    }
21
22
    protected function generateRangeForLength($length)
23
    {