@@ -24,13 +24,13 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | // Constructs an Event object from the given array of key=>values. |
| 26 | 26 | // You can optionally force the timezone of the parsed dates. |
| 27 | - public function __construct($array, $timezone=null) { |
|
| 27 | + public function __construct($array, $timezone = null) { |
|
| 28 | 28 | |
| 29 | 29 | $this->title = $array['title']; |
| 30 | 30 | |
| 31 | 31 | if (isset($array['allDay'])) { |
| 32 | 32 | // allDay has been explicitly specified |
| 33 | - $this->allDay = (bool)$array['allDay']; |
|
| 33 | + $this->allDay = (bool) $array['allDay']; |
|
| 34 | 34 | } |
| 35 | 35 | else { |
| 36 | 36 | // Guess allDay based off of ISO8601 date strings |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | |
| 110 | 110 | // Parses a string into a DateTime object, optionally forced into the given timezone. |
| 111 | -function parseDateTime($string, $timezone=null) { |
|
| 111 | +function parseDateTime($string, $timezone = null) { |
|
| 112 | 112 | $date = new DateTime( |
| 113 | 113 | $string, |
| 114 | 114 | $timezone ? $timezone : new DateTimeZone('UTC') |
@@ -31,8 +31,7 @@ discard block |
||
| 31 | 31 | if (isset($array['allDay'])) { |
| 32 | 32 | // allDay has been explicitly specified |
| 33 | 33 | $this->allDay = (bool)$array['allDay']; |
| 34 | - } |
|
| 35 | - else { |
|
| 34 | + } else { |
|
| 36 | 35 | // Guess allDay based off of ISO8601 date strings |
| 37 | 36 | $this->allDay = preg_match(self::ALL_DAY_REGEX, $array['start']) && |
| 38 | 37 | (!isset($array['end']) || preg_match(self::ALL_DAY_REGEX, $array['end'])); |
@@ -65,8 +64,7 @@ discard block |
||
| 65 | 64 | |
| 66 | 65 | if (isset($this->end)) { |
| 67 | 66 | $eventEnd = stripTime($this->end); // normalize |
| 68 | - } |
|
| 69 | - else { |
|
| 67 | + } else { |
|
| 70 | 68 | $eventEnd = $eventStart; // consider this a zero-duration event |
| 71 | 69 | } |
| 72 | 70 | |
@@ -86,8 +84,7 @@ discard block |
||
| 86 | 84 | // Figure out the date format. This essentially encodes allDay into the date string. |
| 87 | 85 | if ($this->allDay) { |
| 88 | 86 | $format = 'Y-m-d'; // output like "2013-12-29" |
| 89 | - } |
|
| 90 | - else { |
|
| 87 | + } else { |
|
| 91 | 88 | $format = 'c'; // full ISO8601 output, like "2013-12-29T09:00:00+08:00" |
| 92 | 89 | } |
| 93 | 90 | |