Code Duplication    Length = 2-3 lines in 8 locations

src/ArabicCalendar.php 1 location

@@ 68-69 (lines=2) @@
65
	}
66
67
	public function ymdToJd($year, $month, $day) {
68
		if ($month < 1 || $month > $this->monthsInYear()) {
69
			throw new InvalidArgumentException('Month ' . $month . ' is invalid for this calendar');
70
		}
71
72
		return $day + 29 * ($month - 1) + (int) ((6 * $month - 1) / 11) + $year * 354 + (int) ((3 + 11 * $year) / 30) + 1948085;

src/FrenchCalendar.php 2 locations

@@ 28-30 (lines=3) @@
25
	public function daysInMonth($year, $month) {
26
		if ($year <= 0) {
27
			throw new InvalidArgumentException('Year ' . $year . ' is invalid for this calendar');
28
		} elseif ($month < 1 || $month > 13) {
29
			throw new InvalidArgumentException('Month ' . $month . ' is invalid for this calendar');
30
		} elseif ($month !== 13) {
31
			return 30;
32
		} elseif ($this->isLeapYear($year)) {
33
			return 6;
@@ 78-79 (lines=2) @@
75
	}
76
77
	public function ymdToJd($year, $month, $day) {
78
		if ($month < 1 || $month > $this->monthsInYear()) {
79
			throw new InvalidArgumentException('Month ' . $month . ' is invalid for this calendar');
80
		}
81
82
		return 2375444 + $day + $month * 30 + $year * 365 + (int) ($year / 4);

src/GregorianCalendar.php 1 location

@@ 88-89 (lines=2) @@
85
	 * @return integer
86
	 */
87
	public function ymdToJd($year, $month, $day) {
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/JewishCalendar.php 1 location

@@ 177-179 (lines=3) @@
174
	public function daysInMonth($year, $month) {
175
		if ($year < 1) {
176
			throw new InvalidArgumentException('Year ' . $year . ' is invalid for this calendar');
177
		} elseif ($month < 1 || $month > 13) {
178
			throw new InvalidArgumentException('Month ' . $month . ' is invalid for this calendar');
179
		} elseif ($month == 2) {
180
			return $this->daysInMonthHeshvan($year);
181
		} elseif ($month == 3) {
182
			return $this->daysInMonthKislev($year);

src/JulianCalendar.php 2 locations

@@ 28-30 (lines=3) @@
25
	public function daysInMonth($year, $month) {
26
		if ($year === 0) {
27
			throw new InvalidArgumentException('Year ' . $year . ' is invalid for this calendar');
28
		} elseif ($month < 1 || $month > 12) {
29
			throw new InvalidArgumentException('Month ' . $month . ' is invalid for this calendar');
30
		} elseif ($month === 1 || $month === 3 || $month === 5 || $month === 7 || $month === 8 || $month === 10 || $month === 12) {
31
			return 31;
32
		} elseif ($month === 4 || $month === 6 || $month === 9 || $month === 11) {
33
			return 30;
@@ 87-88 (lines=2) @@
84
	}
85
86
	public function ymdToJd($year, $month, $day) {
87
		if ($month < 1 || $month > $this->monthsInYear()) {
88
			throw new InvalidArgumentException('Month ' . $month . ' is invalid for this calendar');
89
		}
90
91
		if ($year < 0) {

src/PersianCalendar.php 1 location

@@ 92-93 (lines=2) @@
89
	}
90
91
	public function ymdToJd($year, $month, $day) {
92
		if ($month < 1 || $month > $this->monthsInYear()) {
93
			throw new InvalidArgumentException('Month ' . $month . ' is invalid for this calendar');
94
		}
95
96
		$epbase = $year - (($year >= 0) ? 474 : 473);