Code Duplication    Length = 9-9 lines in 3 locations

src/AxillaryClasses/Calender.php 3 locations

@@ 83-91 (lines=9) @@
80
     *
81
     * @return \AlgoWeb\xsdTypes\AxillaryClasses\Calender
82
     */
83
    public static function fromDay($day)
84
    {
85
        $re = '/----(0[1-9]|1[0-9]|2[0-9]|3[0-1]|[1-9])([-+][0-1]\d:[0-6]\d|Z*)/';
86
        preg_match_all($re, $day, $matches, PREG_SET_ORDER, 0);
87
        if (count($matches) != 1 && count($matches[0]) != 3) {
88
            throw new \InvalidArgumentException('Unable to extract day from input string');
89
        }
90
        return new self(null, null, $matches[0][1], $matches[0][2]);
91
    }
92
93
    /**
94
     * @param string $monthDay
@@ 113-121 (lines=9) @@
110
     *
111
     * @return \AlgoWeb\xsdTypes\AxillaryClasses\Calender
112
     */
113
    public static function fromMonth($month)
114
    {
115
        $re = '/--(1[0-2]|0[1-9]|[1-9])([-+][0-1]\d:[0-6]\d|Z*)/';
116
        preg_match_all($re, $month, $matches, PREG_SET_ORDER, 0);
117
        if (count($matches) != 1 && count($matches[0]) != 3) {
118
            throw new \InvalidArgumentException('Unable to extract month from input string');
119
        }
120
        return new self(null, $matches[0][1], null, $matches[0][2]);
121
    }
122
123
    /**
124
     * @param string $yearMonth
@@ 143-151 (lines=9) @@
140
     *
141
     * @return \AlgoWeb\xsdTypes\AxillaryClasses\Calender
142
     */
143
    public static function fromYear($year)
144
    {
145
        $re = '/(\d{4})([-+][0-1]\d:[0-6]\d|Z*)/';
146
        preg_match_all($re, $year, $matches, PREG_SET_ORDER, 0);
147
        if (count($matches) != 1 && count($matches[0]) != 3) {
148
            throw new \InvalidArgumentException('Unable to extract month from input string');
149
        }
150
        return new self($matches[0][1], null, null, $matches[0][2]);
151
    }
152
}
153