Code Duplication    Length = 3-3 lines in 2 locations

src/charge/modifiers/addons/Date.php 2 locations

@@ 47-49 (lines=3) @@
44
            return new DateTimeImmutable("$ms[1]-$ms[2]-01");
45
        }
46
47
        if (preg_match('/^(\d{4})-(\d{1,2})-(\d{1,2})$/', $value, $ms)) {
48
            return new DateTimeImmutable("$ms[1]-$ms[2]-$ms[3]");
49
        }
50
51
        if (preg_match('/^(\d{2})\.(\d{4})$/', $value, $ms)) {
52
            return new DateTimeImmutable("$ms[2]-$ms[1]-01");
@@ 55-57 (lines=3) @@
52
            return new DateTimeImmutable("$ms[2]-$ms[1]-01");
53
        }
54
55
        if (preg_match('/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/', $value, $ms)) {
56
            return new DateTimeImmutable("$ms[3]-$ms[2]-$ms[1]");
57
        }
58
59
        throw new \Exception('invalid date given');
60
    }