Completed
Pull Request — master (#163)
by Corey
03:27
created
common/components/Time.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -151,9 +151,9 @@
 block discarded – undo
151 151
     $dt  = new DateTime("now", new DateTimeZone($this->timezone));
152 152
     $dt2 = new DateTime("now", new DateTimeZone($this->timezone));
153 153
     $end   = $dt ->add(new \DateInterval('P1D'))      // add a day, so the end date gets included in the intervals
154
-                 ->add(new \DateInterval('PT2M'));    // add two minutes, to be sure we have everything
154
+                  ->add(new \DateInterval('PT2M'));    // add two minutes, to be sure we have everything
155 155
     $start = $dt2->add(new \DateInterval('PT2M'))  // add two minutes, to be sure we have everything
156
-                 ->sub(new \DateInterval("P${period}D")); // subtract `$period` number of days
156
+                  ->sub(new \DateInterval("P${period}D")); // subtract `$period` number of days
157 157
 
158 158
     $periods = new \DatePeriod($start, new \DateInterval('P1D'), $end, \DatePeriod::EXCLUDE_START_DATE);
159 159
     $local_tz = new \DateTimeZone($this->timezone);
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -36,13 +36,13 @@  discard block
 block discarded – undo
36 36
    * @return \DateTime the parsed time or the default value
37 37
    */
38 38
   public function parse($time, $default = false, string $format = 'Y-m-d') {
39
-    if(is_string($time)) {
39
+    if (is_string($time)) {
40 40
       $dt = DateTime::createFromFormat($format, $time, new DateTimeZone($this->timezone));
41
-      if($dt) {
41
+      if ($dt) {
42 42
         // for some reason, using createFromFromat adds in the time. The regular DateTime constructor _does not_ do this. We manually zero out the time here to make the DateTime objects match.
43 43
         $dt->setTime(0, 0, 0);
44 44
         $formatted = $dt->format($format);
45
-        if($formatted === $time && $this->inBounds($dt)) {
45
+        if ($formatted === $time && $this->inBounds($dt)) {
46 46
           return $dt;
47 47
         }
48 48
       }
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     $test  = strtotime($dt->format('Y-m-d'));
63 63
     $now   = strtotime($this->getLocalDate());
64 64
 
65
-    if($first <= $test && $test <= $now) {
65
+    if ($first <= $test && $test <= $now) {
66 66
       return true;
67 67
     } else {
68 68
       return false;
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
   }
87 87
 
88 88
   public function getLocalTime($timezone = null) {
89
-    if($timezone === null)
89
+    if ($timezone === null)
90 90
       $timezone = $this->timezone;
91 91
 
92 92
     $timestamp = new DateTime("now", new DateTimeZone($timezone));
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
   }
95 95
 
96 96
   public function getLocalDate($timezone = null) {
97
-    if($timezone === null)
97
+    if ($timezone === null)
98 98
       $timezone = $this->timezone;
99 99
 
100 100
     return (new DateTime("now", new DateTimeZone($timezone)))
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 
109 109
   public function getUTCBookends($local) {
110 110
     $local = trim($local);
111
-    if(strpos($local, " ")) {
111
+    if (strpos($local, " ")) {
112 112
       return false;
113 113
     }
114 114
 
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
    * @return string a date string
131 131
    */
132 132
   public function validate($date = null) {
133
-    if(is_null($date)) {
133
+    if (is_null($date)) {
134 134
       return $this->getLocalDate();
135
-    } else if($dt = $this->parse($date)) {
135
+    } else if ($dt = $this->parse($date)) {
136 136
       return $dt->format('Y-m-d');
137 137
     } else {
138 138
       return $this->getLocalDate();
@@ -151,13 +151,13 @@  discard block
 block discarded – undo
151 151
     $dt  = new DateTime("now", new DateTimeZone($this->timezone));
152 152
     $dt2 = new DateTime("now", new DateTimeZone($this->timezone));
153 153
     $end   = $dt ->add(new \DateInterval('P1D'))      // add a day, so the end date gets included in the intervals
154
-                 ->add(new \DateInterval('PT2M'));    // add two minutes, to be sure we have everything
154
+                 ->add(new \DateInterval('PT2M')); // add two minutes, to be sure we have everything
155 155
     $start = $dt2->add(new \DateInterval('PT2M'))  // add two minutes, to be sure we have everything
156 156
                  ->sub(new \DateInterval("P${period}D")); // subtract `$period` number of days
157 157
 
158 158
     $periods = new \DatePeriod($start, new \DateInterval('P1D'), $end, \DatePeriod::EXCLUDE_START_DATE);
159 159
     $local_tz = new \DateTimeZone($this->timezone);
160
-    foreach($periods as $period) {
160
+    foreach ($periods as $period) {
161 161
       $period->setTimezone($local_tz);
162 162
     }
163 163
     return $periods;
Please login to merge, or discard this patch.
common/mail/checkinReport.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -124,14 +124,14 @@  discard block
 block discarded – undo
124 124
                                                 <th style="Margin:0;color:#0a0a0a;font-family:Arial,Verdana,Helvetica,sans-serif;font-size:16px;font-weight:400;line-height:1.3;margin:0;padding:0;text-align:left">
125 125
 
126 126
 <?php
127
-if($questions) {
128
-  foreach($questions as $behavior_id => $behavior_questions) {
127
+if ($questions) {
128
+  foreach ($questions as $behavior_id => $behavior_questions) {
129 129
 ?>
130 130
 
131 131
                                                    <h4 style="Margin:0;Margin-bottom:10px;color:#37b98f;font-family:Arial,Verdana,Helvetica,sans-serif;font-size:24px;font-weight:400;line-height:1.3;margin:0;margin-bottom:5px;padding:0 8px;text-align:left;word-wrap:normal"> <?= $behavior_questions['question']['title'] ?> </h4>
132 132
 
133 133
 <?php
134
-    foreach($behavior_questions['answers'] as $key => $question) {  ?>
134
+    foreach ($behavior_questions['answers'] as $key => $question) {  ?>
135 135
       <p style="Margin:0;Margin-bottom:10px;color:#0a0a0a;font-family:Arial,Verdana,Helvetica,sans-serif;font-size:16px;font-weight:400;line-height:1.3;margin:0;margin-bottom:10px;padding:0 8px 4px 8px;text-align:left"><strong><?=$question['title']?></strong> <?=$question['answer']?></p>
136 136
 <?php
137 137
     }
@@ -188,12 +188,12 @@  discard block
 block discarded – undo
188 188
                                                 <th style="Margin:0;color:#0a0a0a;font-family:Arial,Verdana,Helvetica,sans-serif;font-size:16px;font-weight:400;line-height:1.3;margin:0;padding:0;text-align:left">
189 189
 
190 190
 <?php
191
-if($user_behaviors) {
192
-  foreach($user_behaviors as $user_behavior) { ?>
191
+if ($user_behaviors) {
192
+  foreach ($user_behaviors as $user_behavior) { ?>
193 193
         <p style="Margin:0;Margin-bottom:10px;color:#0a0a0a;font-family:Arial,Verdana,Helvetica,sans-serif;font-size:16px;font-weight:400;line-height:1.3;margin:0;margin-bottom:10px;padding:0 8px 4px 8px;text-align:left">
194 194
           <strong style="color:#37b98f"><?= $user_behavior['category_name'] ?></strong>
195 195
 <?php
196
-    foreach($user_behavior['behaviors'] as $behavior) { ?>
196
+    foreach ($user_behavior['behaviors'] as $behavior) { ?>
197 197
         <br><?= $behavior['name'] ?>
198 198
 <?php
199 199
     }
Please login to merge, or discard this patch.