@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | 'Hour', $h, CALENDAR_VALUE_TOOSMALL.$min); |
206 | 206 | return false; |
207 | 207 | } |
208 | - $max = ($this->cE->getHoursInDay($this->calendar->thisDay())-1); |
|
208 | + $max = ($this->cE->getHoursInDay($this->calendar->thisDay()) - 1); |
|
209 | 209 | if ($h > $max) { |
210 | 210 | $this->errors[] = new ValidationError( |
211 | 211 | 'Hour', $h, CALENDAR_VALUE_TOOLARGE.$max); |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | 'Minute', $i, CALENDAR_VALUE_TOOSMALL.$min); |
230 | 230 | return false; |
231 | 231 | } |
232 | - $max = ($this->cE->getMinutesInHour($this->calendar->thisHour())-1); |
|
232 | + $max = ($this->cE->getMinutesInHour($this->calendar->thisHour()) - 1); |
|
233 | 233 | if ($i > $max) { |
234 | 234 | $this->errors[] = new ValidationError( |
235 | 235 | 'Minute', $i, CALENDAR_VALUE_TOOLARGE.$max); |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | 'Second', $s, CALENDAR_VALUE_TOOSMALL.$min); |
254 | 254 | return false; |
255 | 255 | } |
256 | - $max = ($this->cE->getSecondsInMinute($this->calendar->thisMinute())-1); |
|
256 | + $max = ($this->cE->getSecondsInMinute($this->calendar->thisMinute()) - 1); |
|
257 | 257 | if ($s > $max) { |
258 | 258 | $this->errors[] = new ValidationError( |
259 | 259 | 'Second', $s, CALENDAR_VALUE_TOOLARGE.$max); |
@@ -83,11 +83,11 @@ |
||
83 | 83 | function build($sDates = array()) |
84 | 84 | { |
85 | 85 | $mIH = $this->cE->getMinutesInHour($this->year, $this->month, $this->day, |
86 | - $this->hour); |
|
86 | + $this->hour); |
|
87 | 87 | for ($i=0; $i < $mIH; $i++) { |
88 | 88 | $this->children[$i] = |
89 | 89 | new Minute($this->year, $this->month, $this->day, |
90 | - $this->hour, $i); |
|
90 | + $this->hour, $i); |
|
91 | 91 | } |
92 | 92 | if (count($sDates) > 0) { |
93 | 93 | $this->setSelection($sDates); |
@@ -84,7 +84,7 @@ |
||
84 | 84 | { |
85 | 85 | $mIH = $this->cE->getMinutesInHour($this->year, $this->month, $this->day, |
86 | 86 | $this->hour); |
87 | - for ($i=0; $i < $mIH; $i++) { |
|
87 | + for ($i = 0; $i < $mIH; $i++) { |
|
88 | 88 | $this->children[$i] = |
89 | 89 | new Minute($this->year, $this->month, $this->day, |
90 | 90 | $this->hour, $i); |
@@ -88,13 +88,13 @@ discard block |
||
88 | 88 | { |
89 | 89 | static $engine = false; |
90 | 90 | switch (CALENDAR_ENGINE) { |
91 | - case 'PearDate': |
|
92 | - $class = 'Calendar_Engine_PearDate'; |
|
93 | - break; |
|
94 | - case 'UnixTS': |
|
95 | - default: |
|
96 | - $class = 'PEAR\Calendar\Engine\UnixTS'; |
|
97 | - break; |
|
91 | + case 'PearDate': |
|
92 | + $class = 'Calendar_Engine_PearDate'; |
|
93 | + break; |
|
94 | + case 'UnixTS': |
|
95 | + default: |
|
96 | + $class = 'PEAR\Calendar\Engine\UnixTS'; |
|
97 | + break; |
|
98 | 98 | } |
99 | 99 | if (!$engine) { |
100 | 100 | if (!class_exists($class)) { |
@@ -341,19 +341,19 @@ discard block |
||
341 | 341 | function returnValue($returnType, $format, $stamp, $default) |
342 | 342 | { |
343 | 343 | switch (strtolower($format)) { |
344 | - case 'int': |
|
345 | - return $default; |
|
346 | - case 'array': |
|
347 | - return $this->toArray($stamp); |
|
348 | - break; |
|
349 | - case 'object': |
|
350 | - include_once CALENDAR_ROOT.'Factory.php'; |
|
351 | - return Factory::createByTimestamp($returnType, $stamp); |
|
352 | - break; |
|
353 | - case 'timestamp': |
|
354 | - default: |
|
355 | - return $stamp; |
|
356 | - break; |
|
344 | + case 'int': |
|
345 | + return $default; |
|
346 | + case 'array': |
|
347 | + return $this->toArray($stamp); |
|
348 | + break; |
|
349 | + case 'object': |
|
350 | + include_once CALENDAR_ROOT.'Factory.php'; |
|
351 | + return Factory::createByTimestamp($returnType, $stamp); |
|
352 | + break; |
|
353 | + case 'timestamp': |
|
354 | + default: |
|
355 | + return $stamp; |
|
356 | + break; |
|
357 | 357 | } |
358 | 358 | } |
359 | 359 |
@@ -83,41 +83,41 @@ |
||
83 | 83 | { |
84 | 84 | $firstDay = defined('CALENDAR_FIRST_DAY_OF_WEEK') ? CALENDAR_FIRST_DAY_OF_WEEK : 1; |
85 | 85 | switch ($type) { |
86 | - case 'Day': |
|
87 | - return new Day($y, $m, $d); |
|
88 | - case 'Month': |
|
89 | - // Set default state for which month type to build |
|
90 | - if (!defined('CALENDAR_MONTH_STATE')) { |
|
91 | - define('CALENDAR_MONTH_STATE', CALENDAR_USE_MONTH); |
|
92 | - } |
|
93 | - switch (CALENDAR_MONTH_STATE) { |
|
94 | - case CALENDAR_USE_MONTH_WEEKDAYS: |
|
95 | - $class = 'PEAR\Calendar\Month\Weekdays'; |
|
96 | - break; |
|
97 | - case CALENDAR_USE_MONTH_WEEKS: |
|
98 | - $class = 'PEAR\Calendar\Month\Weeks'; |
|
99 | - break; |
|
100 | - case CALENDAR_USE_MONTH: |
|
101 | - default: |
|
102 | - $class = 'PEAR\Calendar\Month'; |
|
103 | - break; |
|
104 | - } |
|
86 | + case 'Day': |
|
87 | + return new Day($y, $m, $d); |
|
88 | + case 'Month': |
|
89 | + // Set default state for which month type to build |
|
90 | + if (!defined('CALENDAR_MONTH_STATE')) { |
|
91 | + define('CALENDAR_MONTH_STATE', CALENDAR_USE_MONTH); |
|
92 | + } |
|
93 | + switch (CALENDAR_MONTH_STATE) { |
|
94 | + case CALENDAR_USE_MONTH_WEEKDAYS: |
|
95 | + $class = 'PEAR\Calendar\Month\Weekdays'; |
|
96 | + break; |
|
97 | + case CALENDAR_USE_MONTH_WEEKS: |
|
98 | + $class = 'PEAR\Calendar\Month\Weeks'; |
|
99 | + break; |
|
100 | + case CALENDAR_USE_MONTH: |
|
101 | + default: |
|
102 | + $class = 'PEAR\Calendar\Month'; |
|
103 | + break; |
|
104 | + } |
|
105 | 105 | return new $class($y, $m, $firstDay); |
106 | - case 'Week': |
|
107 | - return new Week($y, $m, $d, $firstDay); |
|
108 | - case 'Hour': |
|
109 | - return new Hour($y, $m, $d, $h); |
|
110 | - case 'Minute': |
|
111 | - return new Minute($y, $m, $d, $h, $i); |
|
112 | - case 'Second': |
|
113 | - return new Second($y, $m, $d, $h, $i, $s); |
|
114 | - case 'Year': |
|
115 | - return new Year($y); |
|
116 | - default: |
|
117 | - include_once 'PEAR.php'; |
|
118 | - PEAR::raiseError('Calendar_Factory::create() unrecognised type: '.$type, |
|
119 | - null, PEAR_ERROR_TRIGGER, E_USER_NOTICE, 'Calendar_Factory::create()'); |
|
120 | - return false; |
|
106 | + case 'Week': |
|
107 | + return new Week($y, $m, $d, $firstDay); |
|
108 | + case 'Hour': |
|
109 | + return new Hour($y, $m, $d, $h); |
|
110 | + case 'Minute': |
|
111 | + return new Minute($y, $m, $d, $h, $i); |
|
112 | + case 'Second': |
|
113 | + return new Second($y, $m, $d, $h, $i, $s); |
|
114 | + case 'Year': |
|
115 | + return new Year($y); |
|
116 | + default: |
|
117 | + include_once 'PEAR.php'; |
|
118 | + PEAR::raiseError('Calendar_Factory::create() unrecognised type: '.$type, |
|
119 | + null, PEAR_ERROR_TRIGGER, E_USER_NOTICE, 'Calendar_Factory::create()'); |
|
120 | + return false; |
|
121 | 121 | } |
122 | 122 | } |
123 | 123 |