Code Duplication    Length = 9-9 lines in 3 locations

src/AxillaryClasses/CalenderFactory.php 3 locations

@@ 12-20 (lines=9) @@
9
     *
10
     * @return \AlgoWeb\xsdTypes\AxillaryClasses\Calender
11
     */
12
    public static function fromDay($day)
13
    {
14
        $dayTimezone = '/----(0[1-9]|1[0-9]|2[0-9]|3[0-1]|[1-9])([-+][0-1]\d:[0-6]\d|Z*)/';
15
        preg_match_all($dayTimezone, $day, $matches, PREG_SET_ORDER, 0);
16
        if (count($matches) != 1 || count($matches[0]) != 3) {
17
            throw new \InvalidArgumentException('Unable to extract day from input string');
18
        }
19
        return new self(null, null, $matches[0][1], $matches[0][2]);
20
    }
21
22
    /**
23
     * @param string $monthDay
@@ 42-50 (lines=9) @@
39
     *
40
     * @return \AlgoWeb\xsdTypes\AxillaryClasses\Calender
41
     */
42
    public static function fromMonth($month)
43
    {
44
        $monthTimezone = '/--((?:1[0-2])|(?:0[0-9]))([-+][0-1]\d:[0-6]\d|Z*)/';
45
        preg_match_all($monthTimezone, $month, $matches, PREG_SET_ORDER, 0);
46
        if (count($matches) != 1 || count($matches[0]) != 3) {
47
            throw new \InvalidArgumentException('Unable to extract month from input string');
48
        }
49
        return new self(null, $matches[0][1], null, $matches[0][2]);
50
    }
51
52
    /**
53
     * @param string $yearMonth
@@ 72-80 (lines=9) @@
69
     *
70
     * @return \AlgoWeb\xsdTypes\AxillaryClasses\Calender
71
     */
72
    public static function fromYear($year)
73
    {
74
        $yearTimezone = '/(\d{4})([-+][0-1]\d:[0-6]\d|Z*)/';
75
        preg_match_all($yearTimezone, $year, $matches, PREG_SET_ORDER, 0);
76
        if (count($matches) != 1 || count($matches[0]) != 3) {
77
            throw new \InvalidArgumentException('Unable to extract month from input string');
78
        }
79
        return new self($matches[0][1], null, null, $matches[0][2]);
80
    }
81
}
82