@@ -23,11 +23,13 @@ |
||
23 | 23 | /** |
24 | 24 | * Controller for the source page |
25 | 25 | */ |
26 | -class SourceController extends GedcomRecordController { |
|
26 | +class SourceController extends GedcomRecordController |
|
27 | +{ |
|
27 | 28 | /** |
28 | 29 | * get edit menu |
29 | 30 | */ |
30 | - public function getEditMenu() { |
|
31 | + public function getEditMenu() |
|
32 | + { |
|
31 | 33 | if (!$this->record || $this->record->isPendingDeletion()) { |
32 | 34 | return null; |
33 | 35 | } |
@@ -21,7 +21,8 @@ discard block |
||
21 | 21 | /** |
22 | 22 | * A GEDCOM individual (INDI) object. |
23 | 23 | */ |
24 | -class Individual extends GedcomRecord { |
|
24 | +class Individual extends GedcomRecord |
|
25 | +{ |
|
25 | 26 | const RECORD_TYPE = 'INDI'; |
26 | 27 | const URL_PREFIX = 'individual.php?pid='; |
27 | 28 | |
@@ -41,7 +42,8 @@ discard block |
||
41 | 42 | * @param Tree $tree |
42 | 43 | * @param string[] $xrefs |
43 | 44 | */ |
44 | - public static function load(Tree $tree, array $xrefs) { |
|
45 | + public static function load(Tree $tree, array $xrefs) |
|
46 | + { |
|
45 | 47 | $args = array( |
46 | 48 | 'tree_id' => $tree->getTreeId(), |
47 | 49 | ); |
@@ -76,7 +78,8 @@ discard block |
||
76 | 78 | * |
77 | 79 | * @return bool |
78 | 80 | */ |
79 | - public function canShowName($access_level = null) { |
|
81 | + public function canShowName($access_level = null) |
|
82 | + { |
|
80 | 83 | if ($access_level === null) { |
81 | 84 | $access_level = Auth::accessLevel($this->tree); |
82 | 85 | } |
@@ -91,7 +94,8 @@ discard block |
||
91 | 94 | * |
92 | 95 | * @return bool |
93 | 96 | */ |
94 | - protected function canShowByType($access_level) { |
|
97 | + protected function canShowByType($access_level) |
|
98 | + { |
|
95 | 99 | global $WT_TREE; |
96 | 100 | |
97 | 101 | // Dead people... |
@@ -142,7 +146,8 @@ discard block |
||
142 | 146 | * |
143 | 147 | * @return bool |
144 | 148 | */ |
145 | - private static function isRelated(Individual $target, $distance) { |
|
149 | + private static function isRelated(Individual $target, $distance) |
|
150 | + { |
|
146 | 151 | static $cache = null; |
147 | 152 | |
148 | 153 | $user_individual = self::getInstance($target->tree->getUserPreference(Auth::user(), 'gedcomid'), $target->tree); |
@@ -216,7 +221,8 @@ discard block |
||
216 | 221 | * |
217 | 222 | * @return string |
218 | 223 | */ |
219 | - protected function createPrivateGedcomRecord($access_level) { |
|
224 | + protected function createPrivateGedcomRecord($access_level) |
|
225 | + { |
|
220 | 226 | $SHOW_PRIVATE_RELATIONSHIPS = $this->tree->getPreference('SHOW_PRIVATE_RELATIONSHIPS'); |
221 | 227 | |
222 | 228 | $rec = '0 @' . $this->xref . '@ INDI'; |
@@ -250,7 +256,8 @@ discard block |
||
250 | 256 | * |
251 | 257 | * @return null|string |
252 | 258 | */ |
253 | - protected static function fetchGedcomRecord($xref, $tree_id) { |
|
259 | + protected static function fetchGedcomRecord($xref, $tree_id) |
|
260 | + { |
|
254 | 261 | return Database::prepare( |
255 | 262 | "SELECT i_gedcom FROM `##individuals` WHERE i_id = :xref AND i_file = :tree_id" |
256 | 263 | )->execute(array( |
@@ -267,7 +274,8 @@ discard block |
||
267 | 274 | * |
268 | 275 | * @return int |
269 | 276 | */ |
270 | - public static function compareBirthDate(Individual $x, Individual $y) { |
|
277 | + public static function compareBirthDate(Individual $x, Individual $y) |
|
278 | + { |
|
271 | 279 | return Date::compare($x->getEstimatedBirthDate(), $y->getEstimatedBirthDate()); |
272 | 280 | } |
273 | 281 | |
@@ -279,7 +287,8 @@ discard block |
||
279 | 287 | * |
280 | 288 | * @return int |
281 | 289 | */ |
282 | - public static function compareDeathDate(Individual $x, Individual $y) { |
|
290 | + public static function compareDeathDate(Individual $x, Individual $y) |
|
291 | + { |
|
283 | 292 | return Date::compare($x->getEstimatedDeathDate(), $y->getEstimatedDeathDate()); |
284 | 293 | } |
285 | 294 | |
@@ -289,7 +298,8 @@ discard block |
||
289 | 298 | * |
290 | 299 | * @return bool |
291 | 300 | */ |
292 | - public function isDead() { |
|
301 | + public function isDead() |
|
302 | + { |
|
293 | 303 | $MAX_ALIVE_AGE = $this->tree->getPreference('MAX_ALIVE_AGE'); |
294 | 304 | |
295 | 305 | // "1 DEAT Y" or "1 DEAT/2 DATE" or "1 DEAT/2 PLAC" |
@@ -390,7 +400,8 @@ discard block |
||
390 | 400 | * |
391 | 401 | * @return null|Media |
392 | 402 | */ |
393 | - public function findHighlightedMedia() { |
|
403 | + public function findHighlightedMedia() |
|
404 | + { |
|
394 | 405 | $objectA = null; |
395 | 406 | $objectB = null; |
396 | 407 | $objectC = null; |
@@ -445,7 +456,8 @@ discard block |
||
445 | 456 | * |
446 | 457 | * @return string |
447 | 458 | */ |
448 | - public function displayImage() { |
|
459 | + public function displayImage() |
|
460 | + { |
|
449 | 461 | $media = $this->findHighlightedMedia(); |
450 | 462 | if ($media && $this->canShow()) { |
451 | 463 | // Thumbnail exists - use it. |
@@ -463,7 +475,8 @@ discard block |
||
463 | 475 | * |
464 | 476 | * @return Date |
465 | 477 | */ |
466 | - public function getBirthDate() { |
|
478 | + public function getBirthDate() |
|
479 | + { |
|
467 | 480 | foreach ($this->getAllBirthDates() as $date) { |
468 | 481 | if ($date->isOK()) { |
469 | 482 | return $date; |
@@ -478,7 +491,8 @@ discard block |
||
478 | 491 | * |
479 | 492 | * @return string |
480 | 493 | */ |
481 | - public function getBirthPlace() { |
|
494 | + public function getBirthPlace() |
|
495 | + { |
|
482 | 496 | foreach ($this->getAllBirthPlaces() as $place) { |
483 | 497 | if ($place) { |
484 | 498 | return $place; |
@@ -493,7 +507,8 @@ discard block |
||
493 | 507 | * |
494 | 508 | * @return string the year of birth |
495 | 509 | */ |
496 | - public function getBirthYear() { |
|
510 | + public function getBirthYear() |
|
511 | + { |
|
497 | 512 | return $this->getBirthDate()->minimumDate()->format('%Y'); |
498 | 513 | } |
499 | 514 | |
@@ -502,7 +517,8 @@ discard block |
||
502 | 517 | * |
503 | 518 | * @return Date |
504 | 519 | */ |
505 | - public function getDeathDate() { |
|
520 | + public function getDeathDate() |
|
521 | + { |
|
506 | 522 | foreach ($this->getAllDeathDates() as $date) { |
507 | 523 | if ($date->isOK()) { |
508 | 524 | return $date; |
@@ -517,7 +533,8 @@ discard block |
||
517 | 533 | * |
518 | 534 | * @return string |
519 | 535 | */ |
520 | - public function getDeathPlace() { |
|
536 | + public function getDeathPlace() |
|
537 | + { |
|
521 | 538 | foreach ($this->getAllDeathPlaces() as $place) { |
522 | 539 | if ($place) { |
523 | 540 | return $place; |
@@ -532,7 +549,8 @@ discard block |
||
532 | 549 | * |
533 | 550 | * @return string the year of death |
534 | 551 | */ |
535 | - public function getDeathYear() { |
|
552 | + public function getDeathYear() |
|
553 | + { |
|
536 | 554 | return $this->getDeathDate()->minimumDate()->format('%Y'); |
537 | 555 | } |
538 | 556 | |
@@ -544,7 +562,8 @@ discard block |
||
544 | 562 | * |
545 | 563 | * @return string |
546 | 564 | */ |
547 | - public function getLifeSpan() { |
|
565 | + public function getLifeSpan() |
|
566 | + { |
|
548 | 567 | return |
549 | 568 | /* I18N: A range of years, e.g. “1870–”, “1870–1920”, “–1920” */ I18N::translate( |
550 | 569 | '%1$s–%2$s', |
@@ -558,7 +577,8 @@ discard block |
||
558 | 577 | * |
559 | 578 | * @return Date[] |
560 | 579 | */ |
561 | - public function getAllBirthDates() { |
|
580 | + public function getAllBirthDates() |
|
581 | + { |
|
562 | 582 | foreach (explode('|', WT_EVENTS_BIRT) as $event) { |
563 | 583 | $tmp = $this->getAllEventDates($event); |
564 | 584 | if ($tmp) { |
@@ -574,7 +594,8 @@ discard block |
||
574 | 594 | * |
575 | 595 | * @return string[] |
576 | 596 | */ |
577 | - public function getAllBirthPlaces() { |
|
597 | + public function getAllBirthPlaces() |
|
598 | + { |
|
578 | 599 | foreach (explode('|', WT_EVENTS_BIRT) as $event) { |
579 | 600 | $tmp = $this->getAllEventPlaces($event); |
580 | 601 | if ($tmp) { |
@@ -590,7 +611,8 @@ discard block |
||
590 | 611 | * |
591 | 612 | * @return Date[] |
592 | 613 | */ |
593 | - public function getAllDeathDates() { |
|
614 | + public function getAllDeathDates() |
|
615 | + { |
|
594 | 616 | foreach (explode('|', WT_EVENTS_DEAT) as $event) { |
595 | 617 | $tmp = $this->getAllEventDates($event); |
596 | 618 | if ($tmp) { |
@@ -606,7 +628,8 @@ discard block |
||
606 | 628 | * |
607 | 629 | * @return string[] |
608 | 630 | */ |
609 | - public function getAllDeathPlaces() { |
|
631 | + public function getAllDeathPlaces() |
|
632 | + { |
|
610 | 633 | foreach (explode('|', WT_EVENTS_DEAT) as $event) { |
611 | 634 | $tmp = $this->getAllEventPlaces($event); |
612 | 635 | if ($tmp) { |
@@ -622,7 +645,8 @@ discard block |
||
622 | 645 | * |
623 | 646 | * @return Date |
624 | 647 | */ |
625 | - public function getEstimatedBirthDate() { |
|
648 | + public function getEstimatedBirthDate() |
|
649 | + { |
|
626 | 650 | if (is_null($this->_getEstimatedBirthDate)) { |
627 | 651 | foreach ($this->getAllBirthDates() as $date) { |
628 | 652 | if ($date->isOK()) { |
@@ -707,7 +731,8 @@ discard block |
||
707 | 731 | * |
708 | 732 | * @return Date |
709 | 733 | */ |
710 | - public function getEstimatedDeathDate() { |
|
734 | + public function getEstimatedDeathDate() |
|
735 | + { |
|
711 | 736 | if ($this->_getEstimatedDeathDate === null) { |
712 | 737 | foreach ($this->getAllDeathDates() as $date) { |
713 | 738 | if ($date->isOK()) { |
@@ -734,7 +759,8 @@ discard block |
||
734 | 759 | * |
735 | 760 | * @return string |
736 | 761 | */ |
737 | - public function getSex() { |
|
762 | + public function getSex() |
|
763 | + { |
|
738 | 764 | if (preg_match('/\n1 SEX ([MF])/', $this->gedcom . $this->pending, $match)) { |
739 | 765 | return $match[1]; |
740 | 766 | } else { |
@@ -749,7 +775,8 @@ discard block |
||
749 | 775 | * |
750 | 776 | * @return string |
751 | 777 | */ |
752 | - public function getSexImage($size = 'small') { |
|
778 | + public function getSexImage($size = 'small') |
|
779 | + { |
|
753 | 780 | return self::sexImage($this->getSex(), $size); |
754 | 781 | } |
755 | 782 | |
@@ -761,7 +788,8 @@ discard block |
||
761 | 788 | * |
762 | 789 | * @return string |
763 | 790 | */ |
764 | - public static function sexImage($sex, $size = 'small') { |
|
791 | + public static function sexImage($sex, $size = 'small') |
|
792 | + { |
|
765 | 793 | return '<i class="icon-sex_' . strtolower($sex) . '_' . ($size == 'small' ? '9x9' : '15x15') . '"></i>'; |
766 | 794 | } |
767 | 795 | |
@@ -770,7 +798,8 @@ discard block |
||
770 | 798 | * |
771 | 799 | * @return string |
772 | 800 | */ |
773 | - public function getBoxStyle() { |
|
801 | + public function getBoxStyle() |
|
802 | + { |
|
774 | 803 | $tmp = array('M' => '', 'F' => 'F', 'U' => 'NN'); |
775 | 804 | |
776 | 805 | return 'person_box' . $tmp[$this->getSex()]; |
@@ -783,7 +812,8 @@ discard block |
||
783 | 812 | * |
784 | 813 | * @return Family[] |
785 | 814 | */ |
786 | - public function getSpouseFamilies($access_level = null) { |
|
815 | + public function getSpouseFamilies($access_level = null) |
|
816 | + { |
|
787 | 817 | if ($access_level === null) { |
788 | 818 | $access_level = Auth::accessLevel($this->tree); |
789 | 819 | } |
@@ -809,7 +839,8 @@ discard block |
||
809 | 839 | * |
810 | 840 | * @return Individual|null |
811 | 841 | */ |
812 | - public function getCurrentSpouse() { |
|
842 | + public function getCurrentSpouse() |
|
843 | + { |
|
813 | 844 | $tmp = $this->getSpouseFamilies(); |
814 | 845 | $family = end($tmp); |
815 | 846 | if ($family) { |
@@ -824,7 +855,8 @@ discard block |
||
824 | 855 | * |
825 | 856 | * @return int |
826 | 857 | */ |
827 | - public function getNumberOfChildren() { |
|
858 | + public function getNumberOfChildren() |
|
859 | + { |
|
828 | 860 | if (preg_match('/\n1 NCHI (\d+)(?:\n|$)/', $this->getGedcom(), $match)) { |
829 | 861 | return $match[1]; |
830 | 862 | } else { |
@@ -846,7 +878,8 @@ discard block |
||
846 | 878 | * |
847 | 879 | * @return Family[] |
848 | 880 | */ |
849 | - public function getChildFamilies($access_level = null) { |
|
881 | + public function getChildFamilies($access_level = null) |
|
882 | + { |
|
850 | 883 | if ($access_level === null) { |
851 | 884 | $access_level = Auth::accessLevel($this->tree); |
852 | 885 | } |
@@ -876,7 +909,8 @@ discard block |
||
876 | 909 | * |
877 | 910 | * @return Family|null |
878 | 911 | */ |
879 | - public function getPrimaryChildFamily() { |
|
912 | + public function getPrimaryChildFamily() |
|
913 | + { |
|
880 | 914 | $families = $this->getChildFamilies(); |
881 | 915 | switch (count($families)) { |
882 | 916 | case 0: |
@@ -914,7 +948,8 @@ discard block |
||
914 | 948 | * |
915 | 949 | * @return Family[] |
916 | 950 | */ |
917 | - public function getChildStepFamilies() { |
|
951 | + public function getChildStepFamilies() |
|
952 | + { |
|
918 | 953 | $step_families = array(); |
919 | 954 | $families = $this->getChildFamilies(); |
920 | 955 | foreach ($families as $family) { |
@@ -944,7 +979,8 @@ discard block |
||
944 | 979 | * |
945 | 980 | * @return Family[] |
946 | 981 | */ |
947 | - public function getSpouseStepFamilies() { |
|
982 | + public function getSpouseStepFamilies() |
|
983 | + { |
|
948 | 984 | $step_families = array(); |
949 | 985 | $families = $this->getSpouseFamilies(); |
950 | 986 | foreach ($families as $family) { |
@@ -968,7 +1004,8 @@ discard block |
||
968 | 1004 | * |
969 | 1005 | * @return string |
970 | 1006 | */ |
971 | - public function getChildFamilyLabel(Family $family) { |
|
1007 | + public function getChildFamilyLabel(Family $family) |
|
1008 | + { |
|
972 | 1009 | if (preg_match('/\n1 FAMC @' . $family->getXref() . '@(?:\n[2-9].*)*\n2 PEDI (.+)/', $this->getGedcom(), $match)) { |
973 | 1010 | // A specified pedigree |
974 | 1011 | return GedcomCodePedi::getChildFamilyLabel($match[1]); |
@@ -985,7 +1022,8 @@ discard block |
||
985 | 1022 | * |
986 | 1023 | * @return string |
987 | 1024 | */ |
988 | - public function getStepFamilyLabel(Family $step_family) { |
|
1025 | + public function getStepFamilyLabel(Family $step_family) |
|
1026 | + { |
|
989 | 1027 | foreach ($this->getChildFamilies() as $family) { |
990 | 1028 | if ($family !== $step_family) { |
991 | 1029 | // Must be a step-family |
@@ -1034,7 +1072,8 @@ discard block |
||
1034 | 1072 | * |
1035 | 1073 | * @return string a div block with father & mother names |
1036 | 1074 | */ |
1037 | - public function getPrimaryParentsNames($classname = '', $display = '') { |
|
1075 | + public function getPrimaryParentsNames($classname = '', $display = '') |
|
1076 | + { |
|
1038 | 1077 | $fam = $this->getPrimaryChildFamily(); |
1039 | 1078 | if (!$fam) { |
1040 | 1079 | return ''; |
@@ -1075,7 +1114,8 @@ discard block |
||
1075 | 1114 | } |
1076 | 1115 | |
1077 | 1116 | /** {@inheritdoc} */ |
1078 | - public function getFallBackName() { |
|
1117 | + public function getFallBackName() |
|
1118 | + { |
|
1079 | 1119 | return '@P.N. /@N.N./'; |
1080 | 1120 | } |
1081 | 1121 | |
@@ -1108,7 +1148,8 @@ discard block |
||
1108 | 1148 | * @param string $full |
1109 | 1149 | * @param string $gedcom |
1110 | 1150 | */ |
1111 | - protected function addName($type, $full, $gedcom) { |
|
1151 | + protected function addName($type, $full, $gedcom) |
|
1152 | + { |
|
1112 | 1153 | //////////////////////////////////////////////////////////////////////////// |
1113 | 1154 | // Extract the structured name parts - use for "sortable" names and indexes |
1114 | 1155 | //////////////////////////////////////////////////////////////////////////// |
@@ -1247,7 +1288,8 @@ discard block |
||
1247 | 1288 | /** |
1248 | 1289 | * Extract names from the GEDCOM record. |
1249 | 1290 | */ |
1250 | - public function extractNames() { |
|
1291 | + public function extractNames() |
|
1292 | + { |
|
1251 | 1293 | $this->extractNamesFromFacts(1, 'NAME', $this->getFacts('NAME', false, Auth::accessLevel($this->tree), $this->canShowName())); |
1252 | 1294 | } |
1253 | 1295 | |
@@ -1257,7 +1299,8 @@ discard block |
||
1257 | 1299 | * |
1258 | 1300 | * @return string |
1259 | 1301 | */ |
1260 | - public function formatListDetails() { |
|
1302 | + public function formatListDetails() |
|
1303 | + { |
|
1261 | 1304 | return |
1262 | 1305 | $this->formatFirstMajorFact(WT_EVENTS_BIRT, 1) . |
1263 | 1306 | $this->formatFirstMajorFact(WT_EVENTS_DEAT, 1); |
@@ -1268,7 +1311,8 @@ discard block |
||
1268 | 1311 | * |
1269 | 1312 | * @return string |
1270 | 1313 | */ |
1271 | - public function getShortName() { |
|
1314 | + public function getShortName() |
|
1315 | + { |
|
1272 | 1316 | global $bwidth; |
1273 | 1317 | |
1274 | 1318 | // Estimate number of characters that can fit in box. Calulates to 28 characters in webtrees theme, or 34 if no thumbnail used. |
@@ -20,7 +20,8 @@ discard block |
||
20 | 20 | /** |
21 | 21 | * Definitions for the Gregorian calendar |
22 | 22 | */ |
23 | -class GregorianDate extends CalendarDate { |
|
23 | +class GregorianDate extends CalendarDate |
|
24 | +{ |
|
24 | 25 | /** |
25 | 26 | * Create a date from either: |
26 | 27 | * a Julian day number |
@@ -29,7 +30,8 @@ discard block |
||
29 | 30 | * |
30 | 31 | * @param array|int|CalendarDate $date |
31 | 32 | */ |
32 | - public function __construct($date) { |
|
33 | + public function __construct($date) |
|
34 | + { |
|
33 | 35 | $this->calendar = new GregorianCalendar; |
34 | 36 | parent::__construct($date); |
35 | 37 | } |
@@ -31,7 +31,8 @@ discard block |
||
31 | 31 | * midnight, solar midnight, sunset, sunrise, etc.), we convert on the basis of |
32 | 32 | * midday. |
33 | 33 | */ |
34 | -class CalendarDate { |
|
34 | +class CalendarDate |
|
35 | +{ |
|
35 | 36 | /** @var int[] Convert GEDCOM month names to month numbers */ |
36 | 37 | public static $MONTH_ABBREV = array('' => 0, 'JAN' => 1, 'FEB' => 2, 'MAR' => 3, 'APR' => 4, 'MAY' => 5, 'JUN' => 6, 'JUL' => 7, 'AUG' => 8, 'SEP' => 9, 'OCT' => 10, 'NOV' => 11, 'DEC' => 12); |
37 | 38 | |
@@ -64,7 +65,8 @@ discard block |
||
64 | 65 | * |
65 | 66 | * @param array|int|CalendarDate $date |
66 | 67 | */ |
67 | - public function __construct($date) { |
|
68 | + public function __construct($date) |
|
69 | + { |
|
68 | 70 | // Construct from an integer (a julian day number) |
69 | 71 | if (is_integer($date)) { |
70 | 72 | $this->minJD = $date; |
@@ -134,14 +136,16 @@ discard block |
||
134 | 136 | * |
135 | 137 | * @return bool |
136 | 138 | */ |
137 | - public function isLeapYear() { |
|
139 | + public function isLeapYear() |
|
140 | + { |
|
138 | 141 | return $this->calendar->isLeapYear($this->y); |
139 | 142 | } |
140 | 143 | |
141 | 144 | /** |
142 | 145 | * Set the object’s Julian day number from a potentially incomplete year/month/day |
143 | 146 | */ |
144 | - public function setJdFromYmd() { |
|
147 | + public function setJdFromYmd() |
|
148 | + { |
|
145 | 149 | if ($this->y == 0) { |
146 | 150 | $this->minJD = 0; |
147 | 151 | $this->maxJD = 0; |
@@ -168,7 +172,8 @@ discard block |
||
168 | 172 | * |
169 | 173 | * @return string |
170 | 174 | */ |
171 | - public static function monthNameNominativeCase($month_number, $leap_year) { |
|
175 | + public static function monthNameNominativeCase($month_number, $leap_year) |
|
176 | + { |
|
172 | 177 | static $translated_month_names; |
173 | 178 | |
174 | 179 | if ($translated_month_names === null) { |
@@ -202,7 +207,8 @@ discard block |
||
202 | 207 | * |
203 | 208 | * @return string |
204 | 209 | */ |
205 | - protected function monthNameGenitiveCase($month_number, $leap_year) { |
|
210 | + protected function monthNameGenitiveCase($month_number, $leap_year) |
|
211 | + { |
|
206 | 212 | static $translated_month_names; |
207 | 213 | |
208 | 214 | if ($translated_month_names === null) { |
@@ -236,7 +242,8 @@ discard block |
||
236 | 242 | * |
237 | 243 | * @return string |
238 | 244 | */ |
239 | - protected function monthNameLocativeCase($month_number, $leap_year) { |
|
245 | + protected function monthNameLocativeCase($month_number, $leap_year) |
|
246 | + { |
|
240 | 247 | static $translated_month_names; |
241 | 248 | |
242 | 249 | if ($translated_month_names === null) { |
@@ -270,7 +277,8 @@ discard block |
||
270 | 277 | * |
271 | 278 | * @return string |
272 | 279 | */ |
273 | - protected function monthNameInstrumentalCase($month_number, $leap_year) { |
|
280 | + protected function monthNameInstrumentalCase($month_number, $leap_year) |
|
281 | + { |
|
274 | 282 | static $translated_month_names; |
275 | 283 | |
276 | 284 | if ($translated_month_names === null) { |
@@ -302,7 +310,8 @@ discard block |
||
302 | 310 | * |
303 | 311 | * @return string |
304 | 312 | */ |
305 | - protected function monthNameAbbreviated($month_number, $leap_year) { |
|
313 | + protected function monthNameAbbreviated($month_number, $leap_year) |
|
314 | + { |
|
306 | 315 | static $translated_month_names; |
307 | 316 | |
308 | 317 | if ($translated_month_names === null) { |
@@ -333,7 +342,8 @@ discard block |
||
333 | 342 | * |
334 | 343 | * @return string |
335 | 344 | */ |
336 | - public function dayNames($day_number) { |
|
345 | + public function dayNames($day_number) |
|
346 | + { |
|
337 | 347 | static $translated_day_names; |
338 | 348 | |
339 | 349 | if ($translated_day_names === null) { |
@@ -358,7 +368,8 @@ discard block |
||
358 | 368 | * |
359 | 369 | * @return string |
360 | 370 | */ |
361 | - protected function dayNamesAbbreviated($day_number) { |
|
371 | + protected function dayNamesAbbreviated($day_number) |
|
372 | + { |
|
362 | 373 | static $translated_day_names; |
363 | 374 | |
364 | 375 | if ($translated_day_names === null) { |
@@ -383,7 +394,8 @@ discard block |
||
383 | 394 | * |
384 | 395 | * @return int |
385 | 396 | */ |
386 | - protected function nextYear($year) { |
|
397 | + protected function nextYear($year) |
|
398 | + { |
|
387 | 399 | return $year + 1; |
388 | 400 | } |
389 | 401 | |
@@ -394,7 +406,8 @@ discard block |
||
394 | 406 | * |
395 | 407 | * @return int |
396 | 408 | */ |
397 | - protected function extractYear($year) { |
|
409 | + protected function extractYear($year) |
|
410 | + { |
|
398 | 411 | return (int) $year; |
399 | 412 | } |
400 | 413 | |
@@ -406,7 +419,8 @@ discard block |
||
406 | 419 | * |
407 | 420 | * @return int |
408 | 421 | */ |
409 | - public static function compare(CalendarDate $d1, CalendarDate $d2) { |
|
422 | + public static function compare(CalendarDate $d1, CalendarDate $d2) |
|
423 | + { |
|
410 | 424 | if ($d1->maxJD < $d2->minJD) { |
411 | 425 | return -1; |
412 | 426 | } elseif ($d2->maxJD < $d1->minJD) { |
@@ -429,7 +443,8 @@ discard block |
||
429 | 443 | * |
430 | 444 | * @return string |
431 | 445 | */ |
432 | - public function getAge($full, $jd, $warn_on_negative = true) { |
|
446 | + public function getAge($full, $jd, $warn_on_negative = true) |
|
447 | + { |
|
433 | 448 | if ($this->y == 0 || $jd == 0) { |
434 | 449 | return $full ? '' : '0'; |
435 | 450 | } |
@@ -478,7 +493,8 @@ discard block |
||
478 | 493 | * |
479 | 494 | * @return CalendarDate |
480 | 495 | */ |
481 | - public function convertToCalendar($calendar) { |
|
496 | + public function convertToCalendar($calendar) |
|
497 | + { |
|
482 | 498 | switch ($calendar) { |
483 | 499 | case 'gregorian': |
484 | 500 | return new GregorianDate($this); |
@@ -502,7 +518,8 @@ discard block |
||
502 | 518 | * |
503 | 519 | * @return bool |
504 | 520 | */ |
505 | - public function inValidRange() { |
|
521 | + public function inValidRange() |
|
522 | + { |
|
506 | 523 | return $this->minJD >= $this->calendar->jdStart() && $this->maxJD <= $this->calendar->jdEnd(); |
507 | 524 | } |
508 | 525 | |
@@ -511,7 +528,8 @@ discard block |
||
511 | 528 | * |
512 | 529 | * @return int |
513 | 530 | */ |
514 | - public function monthsInYear() { |
|
531 | + public function monthsInYear() |
|
532 | + { |
|
515 | 533 | return $this->calendar->monthsInYear(); |
516 | 534 | } |
517 | 535 | |
@@ -520,7 +538,8 @@ discard block |
||
520 | 538 | * |
521 | 539 | * @return int |
522 | 540 | */ |
523 | - public function daysInMonth() { |
|
541 | + public function daysInMonth() |
|
542 | + { |
|
524 | 543 | try { |
525 | 544 | return $this->calendar->daysInMonth($this->y, $this->m); |
526 | 545 | } catch (\InvalidArgumentException $ex) { |
@@ -535,7 +554,8 @@ discard block |
||
535 | 554 | * |
536 | 555 | * @return int |
537 | 556 | */ |
538 | - public function daysInWeek() { |
|
557 | + public function daysInWeek() |
|
558 | + { |
|
539 | 559 | return $this->calendar->daysInWeek(); |
540 | 560 | } |
541 | 561 | |
@@ -547,7 +567,8 @@ discard block |
||
547 | 567 | * |
548 | 568 | * @return string |
549 | 569 | */ |
550 | - public function format($format, $qualifier = '') { |
|
570 | + public function format($format, $qualifier = '') |
|
571 | + { |
|
551 | 572 | // Don’t show exact details for inexact dates |
552 | 573 | if (!$this->d) { |
553 | 574 | // The comma is for US "M D, Y" dates |
@@ -663,7 +684,8 @@ discard block |
||
663 | 684 | * |
664 | 685 | * @return string |
665 | 686 | */ |
666 | - protected function formatDayZeros() { |
|
687 | + protected function formatDayZeros() |
|
688 | + { |
|
667 | 689 | if ($this->d > 9) { |
668 | 690 | return I18N::digits($this->d); |
669 | 691 | } else { |
@@ -676,7 +698,8 @@ discard block |
||
676 | 698 | * |
677 | 699 | * @return string |
678 | 700 | */ |
679 | - protected function formatDay() { |
|
701 | + protected function formatDay() |
|
702 | + { |
|
680 | 703 | return I18N::digits($this->d); |
681 | 704 | } |
682 | 705 | |
@@ -685,7 +708,8 @@ discard block |
||
685 | 708 | * |
686 | 709 | * @return string |
687 | 710 | */ |
688 | - protected function formatLongWeekday() { |
|
711 | + protected function formatLongWeekday() |
|
712 | + { |
|
689 | 713 | return $this->dayNames($this->minJD % $this->calendar->daysInWeek()); |
690 | 714 | } |
691 | 715 | |
@@ -694,7 +718,8 @@ discard block |
||
694 | 718 | * |
695 | 719 | * @return string |
696 | 720 | */ |
697 | - protected function formatShortWeekday() { |
|
721 | + protected function formatShortWeekday() |
|
722 | + { |
|
698 | 723 | return $this->dayNamesAbbreviated($this->minJD % $this->calendar->daysInWeek()); |
699 | 724 | } |
700 | 725 | |
@@ -703,7 +728,8 @@ discard block |
||
703 | 728 | * |
704 | 729 | * @return string |
705 | 730 | */ |
706 | - protected function formatIsoWeekday() { |
|
731 | + protected function formatIsoWeekday() |
|
732 | + { |
|
707 | 733 | return I18N::digits($this->minJD % 7 + 1); |
708 | 734 | } |
709 | 735 | |
@@ -712,7 +738,8 @@ discard block |
||
712 | 738 | * |
713 | 739 | * @return string |
714 | 740 | */ |
715 | - protected function formatNumericWeekday() { |
|
741 | + protected function formatNumericWeekday() |
|
742 | + { |
|
716 | 743 | return I18N::digits(($this->minJD + 1) % $this->calendar->daysInWeek()); |
717 | 744 | } |
718 | 745 | |
@@ -721,7 +748,8 @@ discard block |
||
721 | 748 | * |
722 | 749 | * @return string |
723 | 750 | */ |
724 | - protected function formatDayOfYear() { |
|
751 | + protected function formatDayOfYear() |
|
752 | + { |
|
725 | 753 | return I18N::digits($this->minJD - $this->calendar->ymdToJd($this->y, 1, 1)); |
726 | 754 | } |
727 | 755 | |
@@ -730,7 +758,8 @@ discard block |
||
730 | 758 | * |
731 | 759 | * @return string |
732 | 760 | */ |
733 | - protected function formatMonth() { |
|
761 | + protected function formatMonth() |
|
762 | + { |
|
734 | 763 | return I18N::digits($this->m); |
735 | 764 | } |
736 | 765 | |
@@ -739,7 +768,8 @@ discard block |
||
739 | 768 | * |
740 | 769 | * @return string |
741 | 770 | */ |
742 | - protected function formatMonthZeros() { |
|
771 | + protected function formatMonthZeros() |
|
772 | + { |
|
743 | 773 | if ($this->m > 9) { |
744 | 774 | return I18N::digits($this->m); |
745 | 775 | } else { |
@@ -754,7 +784,8 @@ discard block |
||
754 | 784 | * |
755 | 785 | * @return string |
756 | 786 | */ |
757 | - protected function formatLongMonth($case = 'NOMINATIVE') { |
|
787 | + protected function formatLongMonth($case = 'NOMINATIVE') |
|
788 | + { |
|
758 | 789 | switch ($case) { |
759 | 790 | case 'GENITIVE': |
760 | 791 | return $this->monthNameGenitiveCase($this->m, $this->isLeapYear()); |
@@ -774,7 +805,8 @@ discard block |
||
774 | 805 | * |
775 | 806 | * @return string |
776 | 807 | */ |
777 | - protected function formatShortMonth() { |
|
808 | + protected function formatShortMonth() |
|
809 | + { |
|
778 | 810 | return $this->monthNameAbbreviated($this->m, $this->isLeapYear()); |
779 | 811 | } |
780 | 812 | |
@@ -786,7 +818,8 @@ discard block |
||
786 | 818 | * |
787 | 819 | * @return string |
788 | 820 | */ |
789 | - protected function formatShortYear() { |
|
821 | + protected function formatShortYear() |
|
822 | + { |
|
790 | 823 | return $this->formatLongYear(); |
791 | 824 | } |
792 | 825 | |
@@ -795,7 +828,8 @@ discard block |
||
795 | 828 | * |
796 | 829 | * @return string |
797 | 830 | */ |
798 | - protected function formatGedcomDay() { |
|
831 | + protected function formatGedcomDay() |
|
832 | + { |
|
799 | 833 | if ($this->d == 0) { |
800 | 834 | return ''; |
801 | 835 | } else { |
@@ -808,7 +842,8 @@ discard block |
||
808 | 842 | * |
809 | 843 | * @return string |
810 | 844 | */ |
811 | - protected function formatGedcomMonth() { |
|
845 | + protected function formatGedcomMonth() |
|
846 | + { |
|
812 | 847 | // Our simple lookup table doesn't work correctly for Adar on leap years |
813 | 848 | if ($this->m == 7 && $this->calendar instanceof JewishCalendar && !$this->calendar->isLeapYear($this->y)) { |
814 | 849 | return 'ADR'; |
@@ -822,7 +857,8 @@ discard block |
||
822 | 857 | * |
823 | 858 | * @return string |
824 | 859 | */ |
825 | - protected function formatGedcomYear() { |
|
860 | + protected function formatGedcomYear() |
|
861 | + { |
|
826 | 862 | if ($this->y == 0) { |
827 | 863 | return ''; |
828 | 864 | } else { |
@@ -835,7 +871,8 @@ discard block |
||
835 | 871 | * |
836 | 872 | * @return string |
837 | 873 | */ |
838 | - protected function formatLongYear() { |
|
874 | + protected function formatLongYear() |
|
875 | + { |
|
839 | 876 | return I18N::digits($this->y); |
840 | 877 | } |
841 | 878 | |
@@ -844,7 +881,8 @@ discard block |
||
844 | 881 | * |
845 | 882 | * @return int[] |
846 | 883 | */ |
847 | - protected function nextMonth() { |
|
884 | + protected function nextMonth() |
|
885 | + { |
|
848 | 886 | return array($this->m === $this->calendar->monthsInYear() ? $this->nextYear($this->y) : $this->y, ($this->m % $this->calendar->monthsInYear()) + 1); |
849 | 887 | } |
850 | 888 | |
@@ -855,7 +893,8 @@ discard block |
||
855 | 893 | * |
856 | 894 | * @return string |
857 | 895 | */ |
858 | - protected function numberToRomanNumerals($number) { |
|
896 | + protected function numberToRomanNumerals($number) |
|
897 | + { |
|
859 | 898 | if ($number < 1) { |
860 | 899 | // Cannot convert zero/negative numbers |
861 | 900 | return (string) $number; |
@@ -878,7 +917,8 @@ discard block |
||
878 | 917 | * |
879 | 918 | * @return int |
880 | 919 | */ |
881 | - protected function romanNumeralsToNumber($roman) { |
|
920 | + protected function romanNumeralsToNumber($roman) |
|
921 | + { |
|
882 | 922 | $num = 0; |
883 | 923 | foreach (self::$roman_numerals as $key => $value) { |
884 | 924 | if (strpos($roman, $value) === 0) { |
@@ -895,7 +935,8 @@ discard block |
||
895 | 935 | * |
896 | 936 | * @return int[] |
897 | 937 | */ |
898 | - public function todayYmd() { |
|
938 | + public function todayYmd() |
|
939 | + { |
|
899 | 940 | return $this->calendar->jdToYmd(unixtojd()); |
900 | 941 | } |
901 | 942 | |
@@ -904,7 +945,8 @@ discard block |
||
904 | 945 | * |
905 | 946 | * @return CalendarDate |
906 | 947 | */ |
907 | - public function today() { |
|
948 | + public function today() |
|
949 | + { |
|
908 | 950 | $tmp = clone $this; |
909 | 951 | $ymd = $tmp->todayYmd(); |
910 | 952 | $tmp->y = $ymd[0]; |
@@ -922,7 +964,8 @@ discard block |
||
922 | 964 | * |
923 | 965 | * @return string |
924 | 966 | */ |
925 | - public function calendarUrl($date_format) { |
|
967 | + public function calendarUrl($date_format) |
|
968 | + { |
|
926 | 969 | if (strpbrk($date_format, 'dDj') && $this->d) { |
927 | 970 | // If the format includes a day, and the date also includes a day, then use the day view |
928 | 971 | $view = 'day'; |
@@ -24,7 +24,8 @@ discard block |
||
24 | 24 | * Note that these are "theoretical" dates. |
25 | 25 | * "True" dates are based on local lunar observations, and can be a +/- one day. |
26 | 26 | */ |
27 | -class HijriDate extends CalendarDate { |
|
27 | +class HijriDate extends CalendarDate |
|
28 | +{ |
|
28 | 29 | /** @var int[] Convert GEDCOM month names to month numbers */ |
29 | 30 | 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); |
30 | 31 | |
@@ -36,7 +37,8 @@ discard block |
||
36 | 37 | * |
37 | 38 | * @param array|int|CalendarDate $date |
38 | 39 | */ |
39 | - public function __construct($date) { |
|
40 | + public function __construct($date) |
|
41 | + { |
|
40 | 42 | $this->calendar = new ArabicCalendar; |
41 | 43 | parent::__construct($date); |
42 | 44 | } |
@@ -49,7 +51,8 @@ discard block |
||
49 | 51 | * |
50 | 52 | * @return string |
51 | 53 | */ |
52 | - public static function monthNameNominativeCase($month_number, $leap_year) { |
|
54 | + public static function monthNameNominativeCase($month_number, $leap_year) |
|
55 | + { |
|
53 | 56 | static $translated_month_names; |
54 | 57 | |
55 | 58 | if ($translated_month_names === null) { |
@@ -81,7 +84,8 @@ discard block |
||
81 | 84 | * |
82 | 85 | * @return string |
83 | 86 | */ |
84 | - protected function monthNameGenitiveCase($month_number, $leap_year) { |
|
87 | + protected function monthNameGenitiveCase($month_number, $leap_year) |
|
88 | + { |
|
85 | 89 | static $translated_month_names; |
86 | 90 | |
87 | 91 | if ($translated_month_names === null) { |
@@ -113,7 +117,8 @@ discard block |
||
113 | 117 | * |
114 | 118 | * @return string |
115 | 119 | */ |
116 | - protected function monthNameLocativeCase($month_number, $leap_year) { |
|
120 | + protected function monthNameLocativeCase($month_number, $leap_year) |
|
121 | + { |
|
117 | 122 | static $translated_month_names; |
118 | 123 | |
119 | 124 | if ($translated_month_names === null) { |
@@ -145,7 +150,8 @@ discard block |
||
145 | 150 | * |
146 | 151 | * @return string |
147 | 152 | */ |
148 | - protected function monthNameInstrumentalCase($month_number, $leap_year) { |
|
153 | + protected function monthNameInstrumentalCase($month_number, $leap_year) |
|
154 | + { |
|
149 | 155 | static $translated_month_names; |
150 | 156 | |
151 | 157 | if ($translated_month_names === null) { |
@@ -177,7 +183,8 @@ discard block |
||
177 | 183 | * |
178 | 184 | * @return string |
179 | 185 | */ |
180 | - protected function monthNameAbbreviated($month_number, $leap_year) { |
|
186 | + protected function monthNameAbbreviated($month_number, $leap_year) |
|
187 | + { |
|
181 | 188 | return self::monthNameNominativeCase($month_number, $leap_year); |
182 | 189 | } |
183 | 190 | } |
@@ -22,14 +22,17 @@ |
||
22 | 22 | * how it is to be represented.... This class is just a place holder so that |
23 | 23 | * webtrees won’t compain if it receives one. |
24 | 24 | */ |
25 | -class RomanDate extends JulianDate { |
|
25 | +class RomanDate extends JulianDate |
|
26 | +{ |
|
26 | 27 | /** {@inheritdoc} */ |
27 | - protected function formatGedcomYear() { |
|
28 | + protected function formatGedcomYear() |
|
29 | + { |
|
28 | 30 | return sprintf('%04dAUC', $this->y); |
29 | 31 | } |
30 | 32 | |
31 | 33 | /** {@inheritdoc} */ |
32 | - protected function formatLongYear() { |
|
34 | + protected function formatLongYear() |
|
35 | + { |
|
33 | 36 | return $this->y . 'AUC'; |
34 | 37 | } |
35 | 38 | } |
@@ -21,7 +21,8 @@ discard block |
||
21 | 21 | /** |
22 | 22 | * Definitions for the French Republican calendar |
23 | 23 | */ |
24 | -class FrenchDate extends CalendarDate { |
|
24 | +class FrenchDate extends CalendarDate |
|
25 | +{ |
|
25 | 26 | /** @var int[] Convert GEDCOM month names to month numbers */ |
26 | 27 | public static $MONTH_ABBREV = array('' => 0, 'VEND' => 1, 'BRUM' => 2, 'FRIM' => 3, 'NIVO' => 4, 'PLUV' => 5, 'VENT' => 6, 'GERM' => 7, 'FLOR' => 8, 'PRAI' => 9, 'MESS' => 10, 'THER' => 11, 'FRUC' => 12, 'COMP' => 13); |
27 | 28 | |
@@ -33,7 +34,8 @@ discard block |
||
33 | 34 | * |
34 | 35 | * @param array|int|CalendarDate $date |
35 | 36 | */ |
36 | - public function __construct($date) { |
|
37 | + public function __construct($date) |
|
38 | + { |
|
37 | 39 | $this->calendar = new FrenchCalendar; |
38 | 40 | parent::__construct($date); |
39 | 41 | } |
@@ -46,7 +48,8 @@ discard block |
||
46 | 48 | * |
47 | 49 | * @return string |
48 | 50 | */ |
49 | - public static function monthNameNominativeCase($month_number, $leap_year) { |
|
51 | + public static function monthNameNominativeCase($month_number, $leap_year) |
|
52 | + { |
|
50 | 53 | static $translated_month_names; |
51 | 54 | |
52 | 55 | if ($translated_month_names === null) { |
@@ -79,7 +82,8 @@ discard block |
||
79 | 82 | * |
80 | 83 | * @return string |
81 | 84 | */ |
82 | - protected function monthNameGenitiveCase($month_number, $leap_year) { |
|
85 | + protected function monthNameGenitiveCase($month_number, $leap_year) |
|
86 | + { |
|
83 | 87 | static $translated_month_names; |
84 | 88 | |
85 | 89 | if ($translated_month_names === null) { |
@@ -112,7 +116,8 @@ discard block |
||
112 | 116 | * |
113 | 117 | * @return string |
114 | 118 | */ |
115 | - protected function monthNameLocativeCase($month_number, $leap_year) { |
|
119 | + protected function monthNameLocativeCase($month_number, $leap_year) |
|
120 | + { |
|
116 | 121 | static $translated_month_names; |
117 | 122 | |
118 | 123 | if ($translated_month_names === null) { |
@@ -145,7 +150,8 @@ discard block |
||
145 | 150 | * |
146 | 151 | * @return string |
147 | 152 | */ |
148 | - protected function monthNameInstrumentalCase($month_number, $leap_year) { |
|
153 | + protected function monthNameInstrumentalCase($month_number, $leap_year) |
|
154 | + { |
|
149 | 155 | static $translated_month_names; |
150 | 156 | |
151 | 157 | if ($translated_month_names === null) { |
@@ -178,7 +184,8 @@ discard block |
||
178 | 184 | * |
179 | 185 | * @return string |
180 | 186 | */ |
181 | - protected function monthNameAbbreviated($month_number, $leap_year) { |
|
187 | + protected function monthNameAbbreviated($month_number, $leap_year) |
|
188 | + { |
|
182 | 189 | return self::monthNameNominativeCase($month_number, $leap_year); |
183 | 190 | } |
184 | 191 | |
@@ -189,7 +196,8 @@ discard block |
||
189 | 196 | * |
190 | 197 | * @return string |
191 | 198 | */ |
192 | - public function dayNames($day_number) { |
|
199 | + public function dayNames($day_number) |
|
200 | + { |
|
193 | 201 | static $translated_day_names; |
194 | 202 | |
195 | 203 | if ($translated_day_names === null) { |
@@ -217,7 +225,8 @@ discard block |
||
217 | 225 | * |
218 | 226 | * @return string |
219 | 227 | */ |
220 | - protected function dayNamesAbbreviated($day_number) { |
|
228 | + protected function dayNamesAbbreviated($day_number) |
|
229 | + { |
|
221 | 230 | return $this->dayNames($day_number); |
222 | 231 | } |
223 | 232 | |
@@ -226,7 +235,8 @@ discard block |
||
226 | 235 | * |
227 | 236 | * @return string |
228 | 237 | */ |
229 | - protected function formatLongYear() { |
|
238 | + protected function formatLongYear() |
|
239 | + { |
|
230 | 240 | return $this->numberToRomanNumerals($this->y); |
231 | 241 | } |
232 | 242 | } |
@@ -21,7 +21,8 @@ discard block |
||
21 | 21 | /** |
22 | 22 | * Definitions for the Jalali calendar |
23 | 23 | */ |
24 | -class JalaliDate extends CalendarDate { |
|
24 | +class JalaliDate extends CalendarDate |
|
25 | +{ |
|
25 | 26 | /** @var int[] Convert GEDCOM month names to month numbers */ |
26 | 27 | public static $MONTH_ABBREV = array('' => 0, 'FARVA' => 1, 'ORDIB' => 2, 'KHORD' => 3, 'TIR' => 4, 'MORDA' => 5, 'SHAHR' => 6, 'MEHR' => 7, 'ABAN' => 8, 'AZAR' => 9, 'DEY' => 10, 'BAHMA' => 11, 'ESFAN' => 12); |
27 | 28 | |
@@ -33,7 +34,8 @@ discard block |
||
33 | 34 | * |
34 | 35 | * @param array|int|CalendarDate $date |
35 | 36 | */ |
36 | - public function __construct($date) { |
|
37 | + public function __construct($date) |
|
38 | + { |
|
37 | 39 | $this->calendar = new PersianCalendar; |
38 | 40 | parent::__construct($date); |
39 | 41 | } |
@@ -46,7 +48,8 @@ discard block |
||
46 | 48 | * |
47 | 49 | * @return string |
48 | 50 | */ |
49 | - public static function monthNameNominativeCase($month_number, $leap_year) { |
|
51 | + public static function monthNameNominativeCase($month_number, $leap_year) |
|
52 | + { |
|
50 | 53 | static $translated_month_names; |
51 | 54 | |
52 | 55 | if ($translated_month_names === null) { |
@@ -78,7 +81,8 @@ discard block |
||
78 | 81 | * |
79 | 82 | * @return string |
80 | 83 | */ |
81 | - protected function monthNameGenitiveCase($month_number, $leap_year) { |
|
84 | + protected function monthNameGenitiveCase($month_number, $leap_year) |
|
85 | + { |
|
82 | 86 | static $translated_month_names; |
83 | 87 | |
84 | 88 | if ($translated_month_names === null) { |
@@ -110,7 +114,8 @@ discard block |
||
110 | 114 | * |
111 | 115 | * @return string |
112 | 116 | */ |
113 | - protected function monthNameLocativeCase($month_number, $leap_year) { |
|
117 | + protected function monthNameLocativeCase($month_number, $leap_year) |
|
118 | + { |
|
114 | 119 | static $translated_month_names; |
115 | 120 | |
116 | 121 | if ($translated_month_names === null) { |
@@ -142,7 +147,8 @@ discard block |
||
142 | 147 | * |
143 | 148 | * @return string |
144 | 149 | */ |
145 | - protected function monthNameInstrumentalCase($month_number, $leap_year) { |
|
150 | + protected function monthNameInstrumentalCase($month_number, $leap_year) |
|
151 | + { |
|
146 | 152 | static $translated_month_names; |
147 | 153 | |
148 | 154 | if ($translated_month_names === null) { |
@@ -174,7 +180,8 @@ discard block |
||
174 | 180 | * |
175 | 181 | * @return string |
176 | 182 | */ |
177 | - protected function monthNameAbbreviated($month_number, $leap_year) { |
|
183 | + protected function monthNameAbbreviated($month_number, $leap_year) |
|
184 | + { |
|
178 | 185 | static $translated_month_names; |
179 | 186 | |
180 | 187 | if ($translated_month_names === null) { |
@@ -22,7 +22,8 @@ discard block |
||
22 | 22 | * Definitions for the Julian Proleptic calendar |
23 | 23 | * (Proleptic means we extend it backwards, prior to its introduction in 46BC) |
24 | 24 | */ |
25 | -class JulianDate extends CalendarDate { |
|
25 | +class JulianDate extends CalendarDate |
|
26 | +{ |
|
26 | 27 | /** @var bool True for dates recorded in new-style/old-style format, e.g. 2 FEB 1743/44 */ |
27 | 28 | private $new_old_style = false; |
28 | 29 | |
@@ -34,7 +35,8 @@ discard block |
||
34 | 35 | * |
35 | 36 | * @param array|int|CalendarDate $date |
36 | 37 | */ |
37 | - public function __construct($date) { |
|
38 | + public function __construct($date) |
|
39 | + { |
|
38 | 40 | $this->calendar = new JulianCalendar; |
39 | 41 | parent::__construct($date); |
40 | 42 | } |
@@ -46,7 +48,8 @@ discard block |
||
46 | 48 | * |
47 | 49 | * @return int |
48 | 50 | */ |
49 | - protected function nextYear($year) { |
|
51 | + protected function nextYear($year) |
|
52 | + { |
|
50 | 53 | if ($year == -1) { |
51 | 54 | return 1; |
52 | 55 | } else { |
@@ -61,7 +64,8 @@ discard block |
||
61 | 64 | * |
62 | 65 | * @return int |
63 | 66 | */ |
64 | - protected function extractYear($year) { |
|
67 | + protected function extractYear($year) |
|
68 | + { |
|
65 | 69 | if (preg_match('/^(\d\d\d\d)\/\d{1,4}$/', $year, $match)) { |
66 | 70 | // Assume the first year is correct |
67 | 71 | $this->new_old_style = true; |
@@ -79,7 +83,8 @@ discard block |
||
79 | 83 | * |
80 | 84 | * @return string |
81 | 85 | */ |
82 | - protected function formatLongYear() { |
|
86 | + protected function formatLongYear() |
|
87 | + { |
|
83 | 88 | if ($this->y < 0) { |
84 | 89 | return /* I18N: BCE=Before the Common Era, for Julian years < 0. See http://en.wikipedia.org/wiki/Common_Era */ |
85 | 90 | I18N::translate('%s BCE', I18N::digits(-$this->y)); |
@@ -98,7 +103,8 @@ discard block |
||
98 | 103 | * |
99 | 104 | * @return string |
100 | 105 | */ |
101 | - protected function formatGedcomYear() { |
|
106 | + protected function formatGedcomYear() |
|
107 | + { |
|
102 | 108 | if ($this->y < 0) { |
103 | 109 | return sprintf('%04d B.C.', -$this->y); |
104 | 110 | } else { |