22
33namespace org \nameapi \ontology \input \entities \person \age ;
44
5+ /**
6+ * Use the AgeInfoFactory to create one.
7+ */
58class AgeInfo {
69
710 /**
811 * @var int $birthDay
912 */
10- public $ birthDay = null ;
13+ private $ birthDay = null ;
1114
1215 /**
1316 * @var int $birthMonth
1417 */
15- public $ birthMonth = null ;
18+ private $ birthMonth = null ;
1619
1720 /**
1821 * @var int $birthYear
1922 */
20- public $ birthYear = null ;
23+ private $ birthYear = null ;
2124
2225 /**
2326 * @var int[] $birthYearRange
2427 */
25- public $ birthYearRange = null ;
28+ private $ birthYearRange = null ;
2629
2730 /**
28- * @param int $birthDay
29- * @param int $birthMonth
3031 * @param int $birthYear
32+ * @param int $birthMonth
33+ * @param int $birthDay
3134 * @param int[] $birthYearRange
32- * @throws Exception on invalid input data
35+ * @throws \ Exception on invalid input data
3336 * @access public
3437 */
35- public function __construct ($ birthDay , $ birthMonth , $ birthYear , $ birthYearRange ) {
36- if ($ birthDay !=null && ($ birthYear <0 || $ birthYear >2100 )) throw new \Exception ("Year is out of legal range: " + $ birthYear+ "! " );
37- if ($ birthMonth !=null && ($ birthMonth <1 || $ birthMonth >12 )) throw new \Exception ("Month must be 1-12 but was: " + $ birthMonth+ "! " );
38- if ($ birthDay !=null && ($ birthDay <1 || $ birthDay >31 )) throw new \Exception ("Day must be 1-31 but was: " + $ birthDay+ "! " );
38+ public function __construct ($ birthYear , $ birthMonth , $ birthDay , $ birthYearRange ) {
39+ if ($ birthDay !=null && ($ birthYear <0 || $ birthYear >2100 )) throw new \Exception ("Year is out of legal range: " . $ birthYear. "! " );
40+ if ($ birthMonth !=null && ($ birthMonth <1 || $ birthMonth >12 )) throw new \Exception ("Month must be 1-12 but was: " . $ birthMonth. "! " );
41+ if ($ birthDay !=null && ($ birthDay <1 || $ birthDay >31 )) throw new \Exception ("Day must be 1-31 but was: " . $ birthDay. "! " );
3942 if ($ birthYearRange !=null && ($ birthYearRange [0 ]!=null && $ birthYearRange [1 ]!=null )) {
4043 if ($ birthYearRange [0 ] > $ birthYearRange [1 ]) {
41- throw new \Exception ("Year end may not be before year start but it was: start= " + $ birthYearRange [0 ]+ " end= " + $ birthYearRange [1 ]+ "! " );
44+ throw new \Exception ("Year end may not be before year start but it was: start= " . $ birthYearRange [0 ]. " end= " . $ birthYearRange [1 ]. "! " );
4245 }
4346 }
4447 $ this ->birthDay = $ birthDay ;
@@ -53,37 +56,19 @@ public function __construct($birthDay, $birthMonth, $birthYear, $birthYearRange)
5356 public function getBirthDay () {
5457 return $ this ->birthDay ;
5558 }
56- // /**
57- // * @param int $birthDay
58- // */
59- // public function setBirthDay($birthDay) {
60- // $this->birthDay = $birthDay;
61- // }
6259
6360 /**
6461 * @return int
6562 */
6663 public function getBirthMonth () {
6764 return $ this ->birthMonth ;
6865 }
69- // /**
70- // * @param int $birthMonth
71- // */
72- // public function setBirthMonth($birthMonth) {
73- // $this->birthMonth = $birthMonth;
74- // }
7566
7667 /**
7768 * @return int
7869 */
7970 public function getBirthYear () {
8071 return $ this ->birthYear ;
8172 }
82- // /**
83- // * @param int $birthYear
84- // */
85- // public function setBirthYear($birthYear) {
86- // $this->birthYear = $birthYear;
87- // }
8873
8974}
0 commit comments