Code Duplication    Length = 2-3 lines in 8 locations

src/GregorianCalendar.php 1 location

@@ 88-89 (lines=2) @@
85
     */
86
    public function ymdToJd($year, $month, $day)
87
    {
88
        if ($month < 1 || $month > $this->monthsInYear()) {
89
            throw new InvalidArgumentException('Month ' . $month . ' is invalid for this calendar');
90
        }
91
92
        if ($year < 0) {

src/FrenchCalendar.php 2 locations

@@ 38-40 (lines=3) @@
35
    {
36
        if ($year <= 0) {
37
            throw new InvalidArgumentException('Year ' . $year . ' is invalid for this calendar');
38
        } elseif ($month < 1 || $month > 13) {
39
            throw new InvalidArgumentException('Month ' . $month . ' is invalid for this calendar');
40
        } elseif ($month !== 13) {
41
            return 30;
42
        } elseif ($this->isLeapYear($year)) {
43
            return 6;
@@ 145-146 (lines=2) @@
142
     */
143
    public function ymdToJd($year, $month, $day)
144
    {
145
        if ($month < 1 || $month > $this->monthsInYear()) {
146
            throw new InvalidArgumentException('Month ' . $month . ' is invalid for this calendar');
147
        }
148
149
        return 2375444 + $day + $month * 30 + $year * 365 + (int) ($year / 4);

src/JewishCalendar.php 1 location

@@ 190-192 (lines=3) @@
187
    {
188
        if ($year < 1) {
189
            throw new InvalidArgumentException('Year ' . $year . ' is invalid for this calendar');
190
        } elseif ($month < 1 || $month > 13) {
191
            throw new InvalidArgumentException('Month ' . $month . ' is invalid for this calendar');
192
        } elseif ($month == 2) {
193
            return $this->daysInMonthHeshvan($year);
194
        } elseif ($month == 3) {
195
            return $this->daysInMonthKislev($year);

src/JulianCalendar.php 2 locations

@@ 38-40 (lines=3) @@
35
    {
36
        if ($year === 0) {
37
            throw new InvalidArgumentException('Year ' . $year . ' is invalid for this calendar');
38
        } elseif ($month < 1 || $month > 12) {
39
            throw new InvalidArgumentException('Month ' . $month . ' is invalid for this calendar');
40
        } elseif ($month === 1 || $month === 3 || $month === 5 || $month === 7 || $month === 8 || $month === 10 || $month === 12) {
41
            return 31;
42
        } elseif ($month === 4 || $month === 6 || $month === 9 || $month === 11) {
43
            return 30;
@@ 156-157 (lines=2) @@
153
     */
154
    public function ymdToJd($year, $month, $day)
155
    {
156
        if ($month < 1 || $month > $this->monthsInYear()) {
157
            throw new InvalidArgumentException('Month ' . $month . ' is invalid for this calendar');
158
        }
159
160
        if ($year < 0) {

src/ArabicCalendar.php 1 location

@@ 137-138 (lines=2) @@
134
     */
135
    public function ymdToJd($year, $month, $day)
136
    {
137
        if ($month < 1 || $month > $this->monthsInYear()) {
138
            throw new InvalidArgumentException('Month ' . $month . ' is invalid for this calendar');
139
        }
140
141
        return $day + 29 * ($month - 1) + (int) ((6 * $month - 1) / 11) + $year * 354 + (int) ((3 + 11 * $year) / 30) + 1948085;

src/PersianCalendar.php 1 location

@@ 161-162 (lines=2) @@
158
     */
159
    public function ymdToJd($year, $month, $day)
160
    {
161
        if ($month < 1 || $month > $this->monthsInYear()) {
162
            throw new InvalidArgumentException('Month ' . $month . ' is invalid for this calendar');
163
        }
164
165
        $epbase = $year - (($year >= 0) ? 474 : 473);