@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | public function actionBlog() |
56 | 56 | { |
57 | 57 | $time = Yii::$container->get(\common\interfaces\TimeInterface::class); |
58 | - $key = "index_blog_".$time->getLocalDate('UTC'); |
|
58 | + $key = "index_blog_" . $time->getLocalDate('UTC'); |
|
59 | 59 | $posts = Yii::$app->cache->get($key); |
60 | 60 | if ($posts === false) { |
61 | 61 | $posts = \Yii::$app->getModule('blog') |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | if ($model->load(Yii::$app->request->post()) && $model->validate()) { |
139 | 139 | if (!$model->sendEmail()) { |
140 | 140 | $ip = Yii::$app->getRequest()->getUserIP() ?: "UNKNOWN"; |
141 | - Yii::warning("$ip has tried to reset the password for ".$model->email); |
|
141 | + Yii::warning("$ip has tried to reset the password for " . $model->email); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | Yii::$app->session->setFlash('success', 'If there is an account with the submitted email address you will receive further instructions in your email inbox.<br /><br />If the email does not arrive please check your spam folder.'); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | public function actions() |
42 | 42 | { |
43 | 43 | return array_replace_recursive(parent::actions(), [ |
44 | - 'update' => [ // identifier for your editable column action |
|
44 | + 'update' => [// identifier for your editable column action |
|
45 | 45 | 'class' => EditableColumnAction::className(), // action class name |
46 | 46 | 'modelClass' => CustoMBehavior::className(), // the model for the record being edited |
47 | 47 | 'scenario' => CustomBehavior::SCENARIO_DEFAULT, // model scenario assigned before validation & update |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | 'errorOptions' => ['header' => ''], // error summary HTML options |
50 | 50 | 'postOnly' => true, |
51 | 51 | 'ajaxOnly' => true, |
52 | - 'findModel' => function ($id, $action) { |
|
52 | + 'findModel' => function($id, $action) { |
|
53 | 53 | $model = $this->findModel($id); |
54 | 54 | if ($model !== null) { |
55 | 55 | return $model; |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | 'allow' => true, |
29 | 29 | 'roles' => ['@'], |
30 | 30 | ], [ |
31 | - 'actions' => [ 'change-email', ], |
|
31 | + 'actions' => ['change-email', ], |
|
32 | 32 | 'allow' => true, |
33 | 33 | ], |
34 | 34 | ], |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | public function actionExport() |
151 | 151 | { |
152 | 152 | header("Content-Type: text/csv"); |
153 | - header("Content-Disposition: attachment; filename=fsa-data-export-".Yii::$app->user->identity->email."-".date('Ymd').".csv"); |
|
153 | + header("Content-Disposition: attachment; filename=fsa-data-export-" . Yii::$app->user->identity->email . "-" . date('Ymd') . ".csv"); |
|
154 | 154 | |
155 | 155 | $reader = Yii::$app->user->identity->getExportData(); |
156 | 156 | $fp = fopen('php://output', 'w'); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | return $this->redirect(['questions']); |
50 | 50 | } |
51 | 51 | |
52 | - $behaviors = Yii::$container->get(BehaviorInterface::class)::$behaviors; |
|
52 | + $behaviors = Yii::$container->get(BehaviorInterface::class)::$behaviors; |
|
53 | 53 | $custom = \common\models\CustomBehavior::find()->where(['user_id' => Yii::$app->user->id])->asArray()->all(); |
54 | 54 | return $this->render('index', [ |
55 | 55 | 'categories' => Yii::$container->get(CategoryInterface::class)::$categories, |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | $raw_pie_data = $user_behavior::decorate($user_behavior->getBehaviorsWithCounts()); |
136 | 136 | $answer_pie = $user_behavior->getBehaviorsByCategory($raw_pie_data); |
137 | 137 | |
138 | - $pie_data = [ |
|
138 | + $pie_data = [ |
|
139 | 139 | "labels" => array_column($answer_pie, "name"), |
140 | 140 | "datasets" => [[ |
141 | 141 | "data" => array_map('intval', array_column($answer_pie, "count")), |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | |
174 | 174 | $accum = []; |
175 | 175 | foreach ($checkins as $date => $cats) { |
176 | - for ($i = 1; $i <= 7; $i ++) { |
|
176 | + for ($i = 1; $i <= 7; $i++) { |
|
177 | 177 | $accum[$i][] = array_key_exists($i, $cats) ? $cats[$i]['count'] : []; |
178 | 178 | } |
179 | 179 | } |
@@ -165,11 +165,11 @@ |
||
165 | 165 | $start = new DateTime("now", new DateTimeZone($this->timezone)); |
166 | 166 | $end = new DateTime("now", new DateTimeZone($this->timezone)); |
167 | 167 | $oneday = new \DateInterval('P1D'); |
168 | - $end->add($oneday); // add a day, so the end date gets included in the intervals |
|
168 | + $end->add($oneday); // add a day, so the end date gets included in the intervals |
|
169 | 169 | |
170 | 170 | $start->add(new \DateInterval('PT2M')) // add two minutes, in case they just did a check-in |
171 | 171 | ->sub(new \DateInterval("P${period}D")); // subtract `$period` number of days |
172 | - $end->add(new \DateInterval('PT2M')); // add two minutes, in case they just did a check-in |
|
172 | + $end->add(new \DateInterval('PT2M')); // add two minutes, in case they just did a check-in |
|
173 | 173 | |
174 | 174 | $periods = new \DatePeriod($start, $oneday, $end, \DatePeriod::EXCLUDE_START_DATE); |
175 | 175 | $local_tz = new \DateTimeZone($this->timezone); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | { |
32 | 32 | $path = Yii::getAlias('@graphImgPath'); |
33 | 33 | $filename = $this->user->getIdHash() . ".png"; |
34 | - return $path. '/' . $filename; |
|
34 | + return $path . '/' . $filename; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | // format the data into something nicer |
101 | 101 | $accum = []; |
102 | 102 | foreach ($checkins as $checkin_sum) { |
103 | - for ($i = 1; $i <= 7; $i ++) { |
|
103 | + for ($i = 1; $i <= 7; $i++) { |
|
104 | 104 | $accum[$i][] = array_key_exists($i, $checkin_sum) ? $checkin_sum[$i]['count'] : 0; |
105 | 105 | } |
106 | 106 | } |
@@ -29,8 +29,8 @@ |
||
29 | 29 | { |
30 | 30 | return [ |
31 | 31 | 'error' => [ |
32 | - 'class' => 'yii\web\ErrorAction', |
|
33 | - ], |
|
32 | + 'class' => 'yii\web\ErrorAction', |
|
33 | + ], |
|
34 | 34 | 'captcha' => [ |
35 | 35 | 'class' => 'yii\captcha\CaptchaAction', |
36 | 36 | ], |
@@ -123,10 +123,10 @@ discard block |
||
123 | 123 | return AH::map( |
124 | 124 | $user_behaviors, |
125 | 125 | 'id', |
126 | - function ($a) { |
|
126 | + function($a) { |
|
127 | 127 | return AH::getValue($a, 'behavior.name', $a['custom_behavior']); |
128 | 128 | }, |
129 | - function ($b) { |
|
129 | + function($b) { |
|
130 | 130 | return $b['category_id']; |
131 | 131 | } |
132 | 132 | ); |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | public function getCheckinBreakdown(int $period = 30) |
136 | 136 | { |
137 | 137 | $datetimes = $this->time->getDateTimesInPeriod($period); |
138 | - $key = "checkins_".Yii::$app->user->id."_{$period}_".$this->time->getLocalDate(); |
|
138 | + $key = "checkins_" . Yii::$app->user->id . "_{$period}_" . $this->time->getLocalDate(); |
|
139 | 139 | $checkins = Yii::$app->cache->get($key); |
140 | 140 | |
141 | 141 | if ($checkins === false) { |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | */ |
167 | 167 | public function getBehaviorsByCategory(array $decorated_behaviors) |
168 | 168 | { |
169 | - $arr = array_reduce($decorated_behaviors, function ($acc, $row) { |
|
169 | + $arr = array_reduce($decorated_behaviors, function($acc, $row) { |
|
170 | 170 | $cat_id = $row['category_id']; |
171 | 171 | if (array_key_exists($cat_id, $acc)) { |
172 | 172 | $acc[$cat_id]['count'] += $row['count']; |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | { |
227 | 227 | $expire = \Yii::$app->params[$paramPath]; |
228 | 228 | $parts = explode('_', $token); |
229 | - $timestamp = (int) end($parts); |
|
229 | + $timestamp = (int)end($parts); |
|
230 | 230 | if ($timestamp + $expire < time()) { |
231 | 231 | // token expired |
232 | 232 | return false; |
@@ -404,15 +404,15 @@ discard block |
||
404 | 404 | |
405 | 405 | // we should only proceed with sending the email if the user |
406 | 406 | // scored above their set email threshold (User::email_category) |
407 | - $this_checkin = $checkins_last_month[$date]; // gets the check-in |
|
407 | + $this_checkin = $checkins_last_month[$date]; // gets the check-in |
|
408 | 408 | if (!$this_checkin) { |
409 | 409 | return false; |
410 | 410 | } // sanity check |
411 | - $highest_cat_data = end($this_checkin); // gets the data for the highest category from the check-in |
|
411 | + $highest_cat_data = end($this_checkin); // gets the data for the highest category from the check-in |
|
412 | 412 | if (!$highest_cat_data) { |
413 | 413 | return false; |
414 | 414 | } // another sanity check |
415 | - $highest_cat_idx = key($this_checkin); // gets the key of the highest category |
|
415 | + $highest_cat_idx = key($this_checkin); // gets the key of the highest category |
|
416 | 416 | |
417 | 417 | // if the highest category they reached today was less than |
418 | 418 | // the category threshold they have set, don't send the email |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | 'behaviors_list' => \common\models\Behavior::$behaviors, |
444 | 444 | ])->setFrom([Yii::$app->params['supportEmail'] => Yii::$app->name]) |
445 | 445 | ->setReplyTo($this->email) |
446 | - ->setSubject($this->email." has completed a Faster Scale check-in") |
|
446 | + ->setSubject($this->email . " has completed a Faster Scale check-in") |
|
447 | 447 | ->setTo($email); |
448 | 448 | } |
449 | 449 | } |
@@ -523,7 +523,7 @@ discard block |
||
523 | 523 | return \Yii::$app->mailer->compose('signupNotification') |
524 | 524 | ->setFrom([\Yii::$app->params['supportEmail'] => \Yii::$app->name]) |
525 | 525 | ->setTo(\Yii::$app->params['adminEmail']) |
526 | - ->setSubject('A new user has signed up for '.\Yii::$app->name) |
|
526 | + ->setSubject('A new user has signed up for ' . \Yii::$app->name) |
|
527 | 527 | ->send(); |
528 | 528 | } |
529 | 529 | |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | return \Yii::$app->mailer->compose('verifyEmail', ['user' => $this]) |
533 | 533 | ->setFrom([\Yii::$app->params['supportEmail'] => \Yii::$app->name]) |
534 | 534 | ->setTo($this->email) |
535 | - ->setSubject('Please verify your '.\Yii::$app->name .' account') |
|
535 | + ->setSubject('Please verify your ' . \Yii::$app->name . ' account') |
|
536 | 536 | ->send(); |
537 | 537 | } |
538 | 538 | |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | 'email' => $email |
547 | 547 | ])->setFrom([Yii::$app->params['supportEmail'] => Yii::$app->name]) |
548 | 548 | ->setReplyTo($this->email) |
549 | - ->setSubject($this->email." has deleted their The Faster Scale App account") |
|
549 | + ->setSubject($this->email . " has deleted their The Faster Scale App account") |
|
550 | 550 | ->setTo($email); |
551 | 551 | } |
552 | 552 | } |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | unset($row['custom_behavior']); |
573 | 573 | |
574 | 574 | // sort the array into a sensible order |
575 | - uksort($row, function ($a, $b) { |
|
575 | + uksort($row, function($a, $b) { |
|
576 | 576 | return $this->export_order[$a] <=> $this->export_order[$b]; |
577 | 577 | }); |
578 | 578 | return $row; |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | return rtrim( |
599 | 599 | strtr( |
600 | 600 | base64_encode( |
601 | - hash('sha256', $this->id."::".$this->created_at, true) |
|
601 | + hash('sha256', $this->id . "::" . $this->created_at, true) |
|
602 | 602 | ), |
603 | 603 | '+/', |
604 | 604 | '-_' |