1 | <?php |
||
13 | trait Initiator |
||
14 | { |
||
15 | /** |
||
16 | * This fields are just for catching. |
||
17 | * |
||
18 | * @return void |
||
19 | */ |
||
20 | 49 | protected function updateComputedFields() |
|
31 | |||
32 | /** |
||
33 | * Return the JDN of the given gregorian date time. |
||
34 | * |
||
35 | * @param GregorianDateTime $dateTime |
||
36 | * |
||
37 | * @return int |
||
38 | */ |
||
39 | 49 | protected function getJdnFromBase(GregorianDateTime $dateTime): int |
|
47 | |||
48 | /** |
||
49 | * Set the converted year, month and day from the given converter. |
||
50 | * |
||
51 | * @param Converter $converter |
||
52 | * |
||
53 | * @return void |
||
54 | */ |
||
55 | 49 | protected function setDateFromConverter(Converter $converter) |
|
61 | |||
62 | /** |
||
63 | * Set the timestamp field. |
||
64 | */ |
||
65 | 49 | protected function cacheTimestamp() |
|
69 | |||
70 | /** |
||
71 | * Computer the available properties. |
||
72 | * |
||
73 | * @return void |
||
74 | */ |
||
75 | 49 | protected function computeFields() |
|
82 | |||
83 | /** |
||
84 | * Compute the leapYear property. |
||
85 | * |
||
86 | * @return void |
||
87 | */ |
||
88 | 49 | protected function computeLeapYear() |
|
94 | |||
95 | /** |
||
96 | * Compute the dayOfYear property. |
||
97 | * |
||
98 | * @return void |
||
99 | */ |
||
100 | 49 | protected function computeDayOfYear() |
|
104 | |||
105 | /** |
||
106 | * Compute the daysInMonth property. |
||
107 | * |
||
108 | * @return void |
||
109 | */ |
||
110 | 49 | protected function computeDaysInMonth() |
|
114 | |||
115 | /** |
||
116 | * cache the dayOfWeek property. |
||
117 | * |
||
118 | * @return void |
||
119 | */ |
||
120 | 49 | protected function cacheDayOfWeek() |
|
124 | } |
||
125 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: