@@ -45,11 +45,11 @@ |
||
| 45 | 45 | protected $_note= null; |
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | - * @param PhpGedcom\Record\NoteRef $note |
|
| 49 | - * @return Plac |
|
| 50 | - */ |
|
| 48 | + * @param PhpGedcom\Record\NoteRef $note |
|
| 49 | + * @return Plac |
|
| 50 | + */ |
|
| 51 | 51 | public function addNote($note = null) { |
| 52 | - $this->_note[] = $note; |
|
| 53 | - return $this; |
|
| 54 | - } |
|
| 52 | + $this->_note[] = $note; |
|
| 53 | + return $this; |
|
| 54 | + } |
|
| 55 | 55 | } |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | /** |
| 43 | 43 | * array PhpGedcom\Record\NoteRef |
| 44 | 44 | */ |
| 45 | - protected $_note= null; |
|
| 45 | + protected $_note = null; |
|
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | 48 | * @param PhpGedcom\Record\NoteRef $note |
@@ -24,12 +24,12 @@ |
||
| 24 | 24 | /** |
| 25 | 25 | * |
| 26 | 26 | */ |
| 27 | - protected $_isRef = false; |
|
| 27 | + protected $_isRef = false; |
|
| 28 | 28 | |
| 29 | 29 | /** |
| 30 | 30 | * |
| 31 | 31 | */ |
| 32 | - protected $_note = ''; |
|
| 32 | + protected $_note = ''; |
|
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | 35 | * |
@@ -19,134 +19,134 @@ |
||
| 19 | 19 | * |
| 20 | 20 | */ |
| 21 | 21 | class Fam extends \PhpGedcom\Record implements Noteable, Sourceable, Objectable { |
| 22 | - /** |
|
| 23 | - * |
|
| 24 | - */ |
|
| 25 | - protected $_id = null; |
|
| 26 | - |
|
| 27 | - /** |
|
| 28 | - * |
|
| 29 | - */ |
|
| 30 | - protected $_resn = null; |
|
| 22 | + /** |
|
| 23 | + * |
|
| 24 | + */ |
|
| 25 | + protected $_id = null; |
|
| 26 | + |
|
| 27 | + /** |
|
| 28 | + * |
|
| 29 | + */ |
|
| 30 | + protected $_resn = null; |
|
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * |
|
| 34 | - */ |
|
| 35 | - protected $_even = array(); |
|
| 36 | - |
|
| 37 | - |
|
| 38 | - /** |
|
| 39 | - * |
|
| 40 | - */ |
|
| 41 | - protected $_husb = null; |
|
| 42 | - |
|
| 43 | - /** |
|
| 44 | - * |
|
| 45 | - */ |
|
| 46 | - protected $_wife = null; |
|
| 47 | - |
|
| 48 | - /** |
|
| 49 | - * |
|
| 50 | - */ |
|
| 51 | - protected $_chil = array(); |
|
| 52 | - /** |
|
| 53 | - * |
|
| 54 | - */ |
|
| 55 | - protected $_nchi = null; |
|
| 56 | - /** |
|
| 57 | - * |
|
| 58 | - */ |
|
| 59 | - protected $_subm = array(); |
|
| 60 | - |
|
| 61 | - /** |
|
| 62 | - * |
|
| 63 | - */ |
|
| 64 | - protected $_slgs = array(); |
|
| 65 | - |
|
| 66 | - /** |
|
| 67 | - * |
|
| 68 | - */ |
|
| 69 | - protected $_refn = array(); |
|
| 70 | - |
|
| 71 | - /** |
|
| 72 | - * |
|
| 73 | - */ |
|
| 74 | - protected $_rin = null; |
|
| 75 | - /** |
|
| 76 | - * |
|
| 77 | - */ |
|
| 78 | - protected $_chan = null; |
|
| 79 | - |
|
| 80 | - /** |
|
| 81 | - * |
|
| 82 | - */ |
|
| 83 | - protected $_note = array(); |
|
| 84 | - |
|
| 85 | - /** |
|
| 86 | - * |
|
| 87 | - */ |
|
| 88 | - protected $_sour = array(); |
|
| 89 | - |
|
| 90 | - /** |
|
| 91 | - * |
|
| 92 | - */ |
|
| 93 | - protected $_obje = array(); |
|
| 94 | - |
|
| 95 | - /** |
|
| 96 | - * |
|
| 97 | - */ |
|
| 98 | - public function addEven($even) { |
|
| 99 | - $this->_even[$even->getType()] = $even; |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - /** |
|
| 103 | - * @return array |
|
| 104 | - */ |
|
| 105 | - public function getAllEven() { |
|
| 106 | - return $this->_even; |
|
| 107 | - } |
|
| 108 | - /** |
|
| 109 | - * @return void|\PhpGedcom\Record\Fam\Even |
|
| 110 | - */ |
|
| 111 | - public function getEven($key = '') { |
|
| 112 | - if (isset($this->_even[strtoupper($key)])) { |
|
| 113 | - return $this->_even[strtoupper($key)]; |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - } |
|
| 117 | - /** |
|
| 118 | - * |
|
| 119 | - */ |
|
| 120 | - public function addSlgs($slgs = []) { |
|
| 121 | - $this->_slgs[] = $slgs; |
|
| 122 | - } |
|
| 123 | - |
|
| 124 | - /** |
|
| 125 | - * |
|
| 126 | - * |
|
| 127 | - */ |
|
| 128 | - public function addRefn($refn = []) { |
|
| 129 | - $this->_refn[] = $refn; |
|
| 130 | - } |
|
| 131 | - |
|
| 132 | - /** |
|
| 133 | - * |
|
| 134 | - */ |
|
| 135 | - public function addNote($note = []) { |
|
| 136 | - $this->_note[] = $note; |
|
| 137 | - } |
|
| 138 | - |
|
| 139 | - /** |
|
| 140 | - * |
|
| 141 | - */ |
|
| 142 | - public function addSour($sour = []) { |
|
| 143 | - $this->_sour[] = $sour; |
|
| 144 | - } |
|
| 145 | - |
|
| 146 | - /** |
|
| 147 | - * |
|
| 148 | - */ |
|
| 149 | - public function addObje($obje = []) { |
|
| 150 | - $this->_obje[] = $obje; |
|
| 151 | - } |
|
| 32 | + /** |
|
| 33 | + * |
|
| 34 | + */ |
|
| 35 | + protected $_even = array(); |
|
| 36 | + |
|
| 37 | + |
|
| 38 | + /** |
|
| 39 | + * |
|
| 40 | + */ |
|
| 41 | + protected $_husb = null; |
|
| 42 | + |
|
| 43 | + /** |
|
| 44 | + * |
|
| 45 | + */ |
|
| 46 | + protected $_wife = null; |
|
| 47 | + |
|
| 48 | + /** |
|
| 49 | + * |
|
| 50 | + */ |
|
| 51 | + protected $_chil = array(); |
|
| 52 | + /** |
|
| 53 | + * |
|
| 54 | + */ |
|
| 55 | + protected $_nchi = null; |
|
| 56 | + /** |
|
| 57 | + * |
|
| 58 | + */ |
|
| 59 | + protected $_subm = array(); |
|
| 60 | + |
|
| 61 | + /** |
|
| 62 | + * |
|
| 63 | + */ |
|
| 64 | + protected $_slgs = array(); |
|
| 65 | + |
|
| 66 | + /** |
|
| 67 | + * |
|
| 68 | + */ |
|
| 69 | + protected $_refn = array(); |
|
| 70 | + |
|
| 71 | + /** |
|
| 72 | + * |
|
| 73 | + */ |
|
| 74 | + protected $_rin = null; |
|
| 75 | + /** |
|
| 76 | + * |
|
| 77 | + */ |
|
| 78 | + protected $_chan = null; |
|
| 79 | + |
|
| 80 | + /** |
|
| 81 | + * |
|
| 82 | + */ |
|
| 83 | + protected $_note = array(); |
|
| 84 | + |
|
| 85 | + /** |
|
| 86 | + * |
|
| 87 | + */ |
|
| 88 | + protected $_sour = array(); |
|
| 89 | + |
|
| 90 | + /** |
|
| 91 | + * |
|
| 92 | + */ |
|
| 93 | + protected $_obje = array(); |
|
| 94 | + |
|
| 95 | + /** |
|
| 96 | + * |
|
| 97 | + */ |
|
| 98 | + public function addEven($even) { |
|
| 99 | + $this->_even[$even->getType()] = $even; |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + /** |
|
| 103 | + * @return array |
|
| 104 | + */ |
|
| 105 | + public function getAllEven() { |
|
| 106 | + return $this->_even; |
|
| 107 | + } |
|
| 108 | + /** |
|
| 109 | + * @return void|\PhpGedcom\Record\Fam\Even |
|
| 110 | + */ |
|
| 111 | + public function getEven($key = '') { |
|
| 112 | + if (isset($this->_even[strtoupper($key)])) { |
|
| 113 | + return $this->_even[strtoupper($key)]; |
|
| 114 | + } |
|
| 115 | + |
|
| 116 | + } |
|
| 117 | + /** |
|
| 118 | + * |
|
| 119 | + */ |
|
| 120 | + public function addSlgs($slgs = []) { |
|
| 121 | + $this->_slgs[] = $slgs; |
|
| 122 | + } |
|
| 123 | + |
|
| 124 | + /** |
|
| 125 | + * |
|
| 126 | + * |
|
| 127 | + */ |
|
| 128 | + public function addRefn($refn = []) { |
|
| 129 | + $this->_refn[] = $refn; |
|
| 130 | + } |
|
| 131 | + |
|
| 132 | + /** |
|
| 133 | + * |
|
| 134 | + */ |
|
| 135 | + public function addNote($note = []) { |
|
| 136 | + $this->_note[] = $note; |
|
| 137 | + } |
|
| 138 | + |
|
| 139 | + /** |
|
| 140 | + * |
|
| 141 | + */ |
|
| 142 | + public function addSour($sour = []) { |
|
| 143 | + $this->_sour[] = $sour; |
|
| 144 | + } |
|
| 145 | + |
|
| 146 | + /** |
|
| 147 | + * |
|
| 148 | + */ |
|
| 149 | + public function addObje($obje = []) { |
|
| 150 | + $this->_obje[] = $obje; |
|
| 151 | + } |
|
| 152 | 152 | } |
@@ -18,93 +18,93 @@ |
||
| 18 | 18 | * |
| 19 | 19 | */ |
| 20 | 20 | class Sour extends \PhpGedcom\Record { |
| 21 | - /** |
|
| 22 | - * |
|
| 23 | - */ |
|
| 24 | - protected $_sour = null; |
|
| 21 | + /** |
|
| 22 | + * |
|
| 23 | + */ |
|
| 24 | + protected $_sour = null; |
|
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * |
|
| 28 | - */ |
|
| 29 | - protected $_vers = null; |
|
| 26 | + /** |
|
| 27 | + * |
|
| 28 | + */ |
|
| 29 | + protected $_vers = null; |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * |
|
| 33 | - */ |
|
| 34 | - protected $_name = null; |
|
| 31 | + /** |
|
| 32 | + * |
|
| 33 | + */ |
|
| 34 | + protected $_name = null; |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * |
|
| 38 | - */ |
|
| 39 | - protected $_corp = null; |
|
| 36 | + /** |
|
| 37 | + * |
|
| 38 | + */ |
|
| 39 | + protected $_corp = null; |
|
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * |
|
| 43 | - */ |
|
| 44 | - protected $_data = null; |
|
| 41 | + /** |
|
| 42 | + * |
|
| 43 | + */ |
|
| 44 | + protected $_data = null; |
|
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * |
|
| 48 | - * @param Sour\Corp $corp |
|
| 49 | - */ |
|
| 50 | - public function setCorp($corp = []) { |
|
| 51 | - $this->_corp = $corp; |
|
| 52 | - } |
|
| 46 | + /** |
|
| 47 | + * |
|
| 48 | + * @param Sour\Corp $corp |
|
| 49 | + */ |
|
| 50 | + public function setCorp($corp = []) { |
|
| 51 | + $this->_corp = $corp; |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * |
|
| 56 | - * @return Sour\Corp |
|
| 57 | - */ |
|
| 58 | - public function getCorp() { |
|
| 59 | - return $this->_corp; |
|
| 60 | - } |
|
| 54 | + /** |
|
| 55 | + * |
|
| 56 | + * @return Sour\Corp |
|
| 57 | + */ |
|
| 58 | + public function getCorp() { |
|
| 59 | + return $this->_corp; |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * |
|
| 64 | - * @param \PhpGedcom\Record\Head\Sour\Data $data |
|
| 65 | - */ |
|
| 66 | - public function setData($data = []) { |
|
| 67 | - $this->_data = $data; |
|
| 68 | - } |
|
| 62 | + /** |
|
| 63 | + * |
|
| 64 | + * @param \PhpGedcom\Record\Head\Sour\Data $data |
|
| 65 | + */ |
|
| 66 | + public function setData($data = []) { |
|
| 67 | + $this->_data = $data; |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | - /** |
|
| 71 | - * |
|
| 72 | - * @return \PhpGedcom\Record\Head\Sour\Data |
|
| 73 | - */ |
|
| 74 | - public function getData() { |
|
| 75 | - return $this->_data; |
|
| 76 | - } |
|
| 70 | + /** |
|
| 71 | + * |
|
| 72 | + * @return \PhpGedcom\Record\Head\Sour\Data |
|
| 73 | + */ |
|
| 74 | + public function getData() { |
|
| 75 | + return $this->_data; |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | - /** |
|
| 79 | - * |
|
| 80 | - * @return Sour\Name |
|
| 81 | - */ |
|
| 82 | - public function getName() { |
|
| 83 | - return $this->_name; |
|
| 84 | - } |
|
| 78 | + /** |
|
| 79 | + * |
|
| 80 | + * @return Sour\Name |
|
| 81 | + */ |
|
| 82 | + public function getName() { |
|
| 83 | + return $this->_name; |
|
| 84 | + } |
|
| 85 | 85 | |
| 86 | - /** |
|
| 87 | - * |
|
| 88 | - * @param Sour\Name |
|
| 89 | - */ |
|
| 90 | - public function setName($name = []) { |
|
| 91 | - $this->_name = $name; |
|
| 92 | - } |
|
| 86 | + /** |
|
| 87 | + * |
|
| 88 | + * @param Sour\Name |
|
| 89 | + */ |
|
| 90 | + public function setName($name = []) { |
|
| 91 | + $this->_name = $name; |
|
| 92 | + } |
|
| 93 | 93 | |
| 94 | - /** |
|
| 95 | - * |
|
| 96 | - * @return Sour\Version |
|
| 97 | - */ |
|
| 98 | - public function getVersion() { |
|
| 99 | - return $this->_vers; |
|
| 100 | - } |
|
| 94 | + /** |
|
| 95 | + * |
|
| 96 | + * @return Sour\Version |
|
| 97 | + */ |
|
| 98 | + public function getVersion() { |
|
| 99 | + return $this->_vers; |
|
| 100 | + } |
|
| 101 | 101 | |
| 102 | - /** |
|
| 103 | - * |
|
| 104 | - * @param Sour\Version |
|
| 105 | - */ |
|
| 106 | - public function setVersion($version = []) { |
|
| 107 | - $this->_vers = $version; |
|
| 108 | - } |
|
| 102 | + /** |
|
| 103 | + * |
|
| 104 | + * @param Sour\Version |
|
| 105 | + */ |
|
| 106 | + public function setVersion($version = []) { |
|
| 107 | + $this->_vers = $version; |
|
| 108 | + } |
|
| 109 | 109 | |
| 110 | 110 | } |
@@ -18,45 +18,45 @@ |
||
| 18 | 18 | * |
| 19 | 19 | */ |
| 20 | 20 | class Gedc extends \PhpGedcom\Record { |
| 21 | - /** |
|
| 22 | - * |
|
| 23 | - */ |
|
| 24 | - protected $_vers = null; |
|
| 21 | + /** |
|
| 22 | + * |
|
| 23 | + */ |
|
| 24 | + protected $_vers = null; |
|
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * |
|
| 28 | - */ |
|
| 29 | - protected $_form = null; |
|
| 26 | + /** |
|
| 27 | + * |
|
| 28 | + */ |
|
| 29 | + protected $_form = null; |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * |
|
| 33 | - * @return Gedc/version |
|
| 34 | - */ |
|
| 35 | - public function getVersion() { |
|
| 36 | - return $this->_vers; |
|
| 37 | - } |
|
| 31 | + /** |
|
| 32 | + * |
|
| 33 | + * @return Gedc/version |
|
| 34 | + */ |
|
| 35 | + public function getVersion() { |
|
| 36 | + return $this->_vers; |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * |
|
| 41 | - * @param Gedc/version |
|
| 42 | - */ |
|
| 43 | - public function setVersion($vers = []) { |
|
| 44 | - $this->_vers = $vers; |
|
| 45 | - } |
|
| 39 | + /** |
|
| 40 | + * |
|
| 41 | + * @param Gedc/version |
|
| 42 | + */ |
|
| 43 | + public function setVersion($vers = []) { |
|
| 44 | + $this->_vers = $vers; |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * |
|
| 49 | - * @return Gedc/form |
|
| 50 | - */ |
|
| 51 | - public function getForm() { |
|
| 52 | - return $this->_form; |
|
| 53 | - } |
|
| 47 | + /** |
|
| 48 | + * |
|
| 49 | + * @return Gedc/form |
|
| 50 | + */ |
|
| 51 | + public function getForm() { |
|
| 52 | + return $this->_form; |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * |
|
| 57 | - * @param Gedc/version |
|
| 58 | - */ |
|
| 59 | - public function setForm($form = []) { |
|
| 60 | - $this->_form = $form; |
|
| 61 | - } |
|
| 55 | + /** |
|
| 56 | + * |
|
| 57 | + * @param Gedc/version |
|
| 58 | + */ |
|
| 59 | + public function setForm($form = []) { |
|
| 60 | + $this->_form = $form; |
|
| 61 | + } |
|
| 62 | 62 | } |
@@ -50,16 +50,16 @@ |
||
| 50 | 50 | $this->_note[] = $note; |
| 51 | 51 | } |
| 52 | 52 | /** |
| 53 | - * |
|
| 54 | - */ |
|
| 53 | + * |
|
| 54 | + */ |
|
| 55 | 55 | public function addFile($file) |
| 56 | 56 | { |
| 57 | 57 | $this->_file[] = $file; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
| 61 | - * |
|
| 62 | - */ |
|
| 61 | + * |
|
| 62 | + */ |
|
| 63 | 63 | public function addSour($sour) |
| 64 | 64 | { |
| 65 | 65 | $this->_sour[] = $sour; |
@@ -21,105 +21,105 @@ |
||
| 21 | 21 | * @package PhpGedcom\Record |
| 22 | 22 | */ |
| 23 | 23 | class Date extends Record { |
| 24 | - /** |
|
| 25 | - * @var string |
|
| 26 | - */ |
|
| 27 | - protected $date = null; |
|
| 24 | + /** |
|
| 25 | + * @var string |
|
| 26 | + */ |
|
| 27 | + protected $date = null; |
|
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * @var array |
|
| 31 | - */ |
|
| 32 | - private $months = [ |
|
| 33 | - 'JAN' => 1, 'FEB' => 2, 'MAR' => 3, 'APR' => 4, 'MAY' => 5, 'JUN' => 6, |
|
| 34 | - 'JUL' => 7, 'AUG' => 8, 'SEP' => 9, 'OCT' => 10, 'NOV' => 11, 'DEC' => 12, |
|
| 35 | - ]; |
|
| 29 | + /** |
|
| 30 | + * @var array |
|
| 31 | + */ |
|
| 32 | + private $months = [ |
|
| 33 | + 'JAN' => 1, 'FEB' => 2, 'MAR' => 3, 'APR' => 4, 'MAY' => 5, 'JUN' => 6, |
|
| 34 | + 'JUL' => 7, 'AUG' => 8, 'SEP' => 9, 'OCT' => 10, 'NOV' => 11, 'DEC' => 12, |
|
| 35 | + ]; |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * @param string $date Date array |
|
| 39 | - * @return Date |
|
| 40 | - */ |
|
| 41 | - public function setDate($date) { |
|
| 42 | - $this->date = $date; |
|
| 37 | + /** |
|
| 38 | + * @param string $date Date array |
|
| 39 | + * @return Date |
|
| 40 | + */ |
|
| 41 | + public function setDate($date) { |
|
| 42 | + $this->date = $date; |
|
| 43 | 43 | |
| 44 | - return $this; |
|
| 45 | - } |
|
| 44 | + return $this; |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * @return null|string |
|
| 49 | - */ |
|
| 50 | - public function getDate() { |
|
| 51 | - return $this->date; |
|
| 52 | - } |
|
| 47 | + /** |
|
| 48 | + * @return null|string |
|
| 49 | + */ |
|
| 50 | + public function getDate() { |
|
| 51 | + return $this->date; |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * Return month part of date |
|
| 56 | - * |
|
| 57 | - * @return int|null |
|
| 58 | - */ |
|
| 59 | - public function getMonth() { |
|
| 60 | - $record = explode(' ', $this->date); |
|
| 61 | - if (count($record) > 0) { |
|
| 62 | - if ($this->isPrefix($record[0])) { |
|
| 63 | - unset($record[0]); |
|
| 64 | - } |
|
| 65 | - foreach ($record as $part) { |
|
| 66 | - if (isset($this->months[trim($part)])) { |
|
| 67 | - return $this->months[trim($part)]; |
|
| 68 | - } |
|
| 69 | - } |
|
| 70 | - } |
|
| 54 | + /** |
|
| 55 | + * Return month part of date |
|
| 56 | + * |
|
| 57 | + * @return int|null |
|
| 58 | + */ |
|
| 59 | + public function getMonth() { |
|
| 60 | + $record = explode(' ', $this->date); |
|
| 61 | + if (count($record) > 0) { |
|
| 62 | + if ($this->isPrefix($record[0])) { |
|
| 63 | + unset($record[0]); |
|
| 64 | + } |
|
| 65 | + foreach ($record as $part) { |
|
| 66 | + if (isset($this->months[trim($part)])) { |
|
| 67 | + return $this->months[trim($part)]; |
|
| 68 | + } |
|
| 69 | + } |
|
| 70 | + } |
|
| 71 | 71 | |
| 72 | - return null; |
|
| 73 | - } |
|
| 72 | + return null; |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - /** |
|
| 76 | - * Return year part of date |
|
| 77 | - * |
|
| 78 | - * @return int|null |
|
| 79 | - */ |
|
| 80 | - public function getYear() { |
|
| 81 | - $record = explode(' ', $this->date); |
|
| 82 | - if (count($record) > 0) { |
|
| 83 | - if ($this->isPrefix($record[0])) { |
|
| 84 | - unset($record[0]); |
|
| 85 | - } |
|
| 86 | - if (count($record) > 0) { |
|
| 87 | - return (int) end($record); |
|
| 88 | - } |
|
| 89 | - } |
|
| 75 | + /** |
|
| 76 | + * Return year part of date |
|
| 77 | + * |
|
| 78 | + * @return int|null |
|
| 79 | + */ |
|
| 80 | + public function getYear() { |
|
| 81 | + $record = explode(' ', $this->date); |
|
| 82 | + if (count($record) > 0) { |
|
| 83 | + if ($this->isPrefix($record[0])) { |
|
| 84 | + unset($record[0]); |
|
| 85 | + } |
|
| 86 | + if (count($record) > 0) { |
|
| 87 | + return (int) end($record); |
|
| 88 | + } |
|
| 89 | + } |
|
| 90 | 90 | |
| 91 | - return null; |
|
| 92 | - } |
|
| 91 | + return null; |
|
| 92 | + } |
|
| 93 | 93 | |
| 94 | - /** |
|
| 95 | - * Return day part of date |
|
| 96 | - * |
|
| 97 | - * @return int|null |
|
| 98 | - */ |
|
| 99 | - public function getDay() { |
|
| 100 | - $record = explode(' ', $this->date); |
|
| 101 | - if (!empty($record[0])) { |
|
| 102 | - if ($this->isPrefix($record[0])) { |
|
| 103 | - unset($record[0]); |
|
| 104 | - } |
|
| 105 | - if (count($record) > 0) { |
|
| 106 | - $day = (int) reset($record); |
|
| 107 | - if ($day >= 1 && $day <= 31) { |
|
| 108 | - return $day; |
|
| 109 | - } |
|
| 110 | - } |
|
| 111 | - } |
|
| 94 | + /** |
|
| 95 | + * Return day part of date |
|
| 96 | + * |
|
| 97 | + * @return int|null |
|
| 98 | + */ |
|
| 99 | + public function getDay() { |
|
| 100 | + $record = explode(' ', $this->date); |
|
| 101 | + if (!empty($record[0])) { |
|
| 102 | + if ($this->isPrefix($record[0])) { |
|
| 103 | + unset($record[0]); |
|
| 104 | + } |
|
| 105 | + if (count($record) > 0) { |
|
| 106 | + $day = (int) reset($record); |
|
| 107 | + if ($day >= 1 && $day <= 31) { |
|
| 108 | + return $day; |
|
| 109 | + } |
|
| 110 | + } |
|
| 111 | + } |
|
| 112 | 112 | |
| 113 | - return null; |
|
| 114 | - } |
|
| 113 | + return null; |
|
| 114 | + } |
|
| 115 | 115 | |
| 116 | - /** |
|
| 117 | - * Check if the first part is a prefix (eg 'BEF', 'ABT',). |
|
| 118 | - * |
|
| 119 | - * @param string $datePart Date part to be checked |
|
| 120 | - * @return bool |
|
| 121 | - */ |
|
| 122 | - private function isPrefix($datePart) { |
|
| 123 | - return in_array($datePart, ['FROM', 'TO', 'BEF', 'AFT', 'BET', 'AND', 'ABT', 'EST', 'CAL', 'INT']); |
|
| 124 | - } |
|
| 116 | + /** |
|
| 117 | + * Check if the first part is a prefix (eg 'BEF', 'ABT',). |
|
| 118 | + * |
|
| 119 | + * @param string $datePart Date part to be checked |
|
| 120 | + * @return bool |
|
| 121 | + */ |
|
| 122 | + private function isPrefix($datePart) { |
|
| 123 | + return in_array($datePart, ['FROM', 'TO', 'BEF', 'AFT', 'BET', 'AND', 'ABT', 'EST', 'CAL', 'INT']); |
|
| 124 | + } |
|
| 125 | 125 | } |
| 126 | 126 | \ No newline at end of file |
@@ -22,9 +22,9 @@ |
||
| 22 | 22 | /** |
| 23 | 23 | * string entry_recording_date |
| 24 | 24 | */ |
| 25 | - protected $_date = null; |
|
| 25 | + protected $_date = null; |
|
| 26 | 26 | /** |
| 27 | 27 | * string text_from_source |
| 28 | 28 | */ |
| 29 | - protected $_text = null; |
|
| 29 | + protected $_text = null; |
|
| 30 | 30 | } |
@@ -27,12 +27,12 @@ discard block |
||
| 27 | 27 | if (substr($method, 0, 3) == 'add') { |
| 28 | 28 | $arr = strtolower(substr($method, 3)); |
| 29 | 29 | |
| 30 | - if (!property_exists($this, '_' . $arr) || !is_array($this->{'_' . $arr})) { |
|
| 31 | - throw new \Exception('Unknown ' . get_class($this) . '::' . $arr); |
|
| 30 | + if (!property_exists($this, '_'.$arr) || !is_array($this->{'_'.$arr})) { |
|
| 31 | + throw new \Exception('Unknown '.get_class($this).'::'.$arr); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | if (!is_array($args)) { |
| 35 | - throw new \Exception('Incorrect arguments to ' . $method); |
|
| 35 | + throw new \Exception('Incorrect arguments to '.$method); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | if (!isset($args[0])) { |
@@ -44,18 +44,18 @@ discard block |
||
| 44 | 44 | // Type safety? |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - $this->{'_' . $arr}[] = $args[0]; |
|
| 47 | + $this->{'_'.$arr}[] = $args[0]; |
|
| 48 | 48 | |
| 49 | 49 | return $this; |
| 50 | 50 | } elseif (substr($method, 0, 3) == 'set') { |
| 51 | 51 | $arr = strtolower(substr($method, 3)); |
| 52 | 52 | |
| 53 | - if (!property_exists($this, '_' . $arr)) { |
|
| 54 | - throw new \Exception('Unknown ' . get_class($this) . '::' . $arr); |
|
| 53 | + if (!property_exists($this, '_'.$arr)) { |
|
| 54 | + throw new \Exception('Unknown '.get_class($this).'::'.$arr); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | if (!is_array($args)) { |
| 58 | - throw new \Exception('Incorrect arguments to ' . $method); |
|
| 58 | + throw new \Exception('Incorrect arguments to '.$method); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | if (!isset($args[0])) { |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | // Type safety? |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - $this->{'_' . $arr} = $args[0]; |
|
| 70 | + $this->{'_'.$arr} = $args[0]; |
|
| 71 | 71 | |
| 72 | 72 | return $this; |
| 73 | 73 | } elseif (substr($method, 0, 3) == 'get') { |
@@ -76,18 +76,18 @@ discard block |
||
| 76 | 76 | // hotfix getData |
| 77 | 77 | if ('data' == $arr) { |
| 78 | 78 | if (!property_exists($this, '_text')) { |
| 79 | - throw new \Exception('Unknown ' . get_class($this) . '::' . $arr); |
|
| 79 | + throw new \Exception('Unknown '.get_class($this).'::'.$arr); |
|
| 80 | 80 | } |
| 81 | 81 | return $this->{'_text'}; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - if (!property_exists($this, '_' . $arr)) { |
|
| 85 | - throw new \Exception('Unknown ' . get_class($this) . '::' . $arr); |
|
| 84 | + if (!property_exists($this, '_'.$arr)) { |
|
| 85 | + throw new \Exception('Unknown '.get_class($this).'::'.$arr); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - return $this->{'_' . $arr}; |
|
| 88 | + return $this->{'_'.$arr}; |
|
| 89 | 89 | } else { |
| 90 | - throw new \Exception('Unknown method called: ' . $method); |
|
| 90 | + throw new \Exception('Unknown method called: '.$method); |
|
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | public function __set($var, $val) |
| 98 | 98 | { |
| 99 | 99 | // this class does not have any public vars |
| 100 | - throw new \Exception('Undefined property ' . get_class() . '::' . $var); |
|
| 100 | + throw new \Exception('Undefined property '.get_class().'::'.$var); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | /** |
@@ -109,6 +109,6 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | public function hasAttribute($var) |
| 111 | 111 | { |
| 112 | - return property_exists($this, '_' . $var) || property_Exists($this, $var); |
|
| 112 | + return property_exists($this, '_'.$var) || property_Exists($this, $var); |
|
| 113 | 113 | } |
| 114 | 114 | } |