summaryrefslogtreecommitdiff
path: root/app/Date/HijriDate.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Date/HijriDate.php')
-rw-r--r--app/Date/HijriDate.php61
1 files changed, 51 insertions, 10 deletions
diff --git a/app/Date/HijriDate.php b/app/Date/HijriDate.php
index f15750c71c..4a04f89691 100644
--- a/app/Date/HijriDate.php
+++ b/app/Date/HijriDate.php
@@ -1,6 +1,4 @@
<?php
-namespace Fisharebest\Webtrees\Date;
-
/**
* webtrees: online genealogy
* Copyright (C) 2015 webtrees development team
@@ -15,27 +13,42 @@ namespace Fisharebest\Webtrees\Date;
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+namespace Fisharebest\Webtrees\Date;
use Fisharebest\ExtCalendar\ArabicCalendar;
use Fisharebest\Webtrees\I18N;
/**
- * Class HijriDate - Definitions for the Hijri calendar.
+ * Definitions for the Hijri calendar.
*
* Note that these are "theoretical" dates.
* "True" dates are based on local lunar observations, and can be a +/- one day.
*/
class HijriDate extends CalendarDate {
- /** {@inheritdoc} */
+ /** @var integer[] Convert GEDCOM month names to month numbers */
public static $MONTH_ABBREV = array('' => 0, 'MUHAR' => 1, 'SAFAR' => 2, 'RABIA' => 3, 'RABIT' => 4, 'JUMAA' => 5, 'JUMAT' => 6, 'RAJAB' => 7, 'SHAAB' => 8, 'RAMAD' => 9, 'SHAWW' => 10, 'DHUAQ' => 11, 'DHUAH' => 12);
- /** {@inheritdoc} */
+ /**
+ * Create a date from either:
+ * a Julian day number
+ * day/month/year strings from a GEDCOM date
+ * another CalendarDate object
+ *
+ * @param array|int|CalendarDate $date
+ */
public function __construct($date) {
$this->calendar = new ArabicCalendar;
parent::__construct($date);
}
- /** {@inheritdoc} */
+ /**
+ * Full month name in nominative case.
+ *
+ * @param int $month_number
+ * @param bool $leap_year Some calendars use leap months
+ *
+ * @return string
+ */
public static function monthNameNominativeCase($month_number, $leap_year) {
static $translated_month_names;
@@ -60,7 +73,14 @@ class HijriDate extends CalendarDate {
return $translated_month_names[$month_number];
}
- /** {@inheritdoc} */
+ /**
+ * Full month name in genitive case.
+ *
+ * @param int $month_number
+ * @param bool $leap_year Some calendars use leap months
+ *
+ * @return string
+ */
protected function monthNameGenitiveCase($month_number, $leap_year) {
static $translated_month_names;
@@ -85,7 +105,14 @@ class HijriDate extends CalendarDate {
return $translated_month_names[$month_number];
}
- /** {@inheritdoc} */
+ /**
+ * Full month name in locative case.
+ *
+ * @param int $month_number
+ * @param bool $leap_year Some calendars use leap months
+ *
+ * @return string
+ */
protected function monthNameLocativeCase($month_number, $leap_year) {
static $translated_month_names;
@@ -110,7 +137,14 @@ class HijriDate extends CalendarDate {
return $translated_month_names[$month_number];
}
- /** {@inheritdoc} */
+ /**
+ * Full month name in instrumental case.
+ *
+ * @param int $month_number
+ * @param bool $leap_year Some calendars use leap months
+ *
+ * @return string
+ */
protected function monthNameInstrumentalCase($month_number, $leap_year) {
static $translated_month_names;
@@ -135,7 +169,14 @@ class HijriDate extends CalendarDate {
return $translated_month_names[$month_number];
}
- /** {@inheritdoc} */
+ /**
+ * Abbreviated month name
+ *
+ * @param int $month_number
+ * @param bool $leap_year Some calendars use leap months
+ *
+ * @return string
+ */
protected function monthNameAbbreviated($month_number, $leap_year) {
return self::monthNameNominativeCase($month_number, $leap_year);
}