Completed
Push — master ( 54df0c...cea4a8 )
by Corey
02:38
created
site/controllers/ProfileController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
     if ($editProfileForm->load(Yii::$app->request->post())) {
69 69
       $saved_user = $editProfileForm->saveProfile();
70
-      if($saved_user) {
70
+      if ($saved_user) {
71 71
         Yii::$app->getSession()->setFlash('success', 'New profile data saved!');
72 72
       }
73 73
     }
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
     $model = Yii::$container->get(\site\models\DeleteAccountForm::class, [Yii::$app->user->identity]);
86 86
 
87 87
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
88
-      if($model->deleteAccount()) {
88
+      if ($model->deleteAccount()) {
89 89
         $this->redirect(['site/index']);
90 90
       } else {
91 91
         Yii::$app->getSession()->setFlash('error', 'Wrong password!');
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
     $model = Yii::$container->get(\site\models\ChangePasswordForm::class, [Yii::$app->user->identity]);
101 101
 
102 102
     if ($model->load(Yii::$app->request->post())) {
103
-      if($model->validate() && $model->changePassword()) {
103
+      if ($model->validate() && $model->changePassword()) {
104 104
         Yii::$app->getSession()->setFlash('success', 'Password successfully changed');
105 105
       } else {
106 106
         Yii::$app->getSession()->setFlash('error', 'Wrong password!');
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
   public function actionExport()
114 114
   {
115 115
     header("Content-Type: text/csv");
116
-    header("Content-Disposition: attachment; filename=fsa-data-export-".Yii::$app->user->identity->email."-".date('Ymd').".csv");
116
+    header("Content-Disposition: attachment; filename=fsa-data-export-" . Yii::$app->user->identity->email . "-" . date('Ymd') . ".csv");
117 117
 
118 118
     $reader = Yii::$app->user->identity->getExportData();
119 119
     $fp = fopen('php://output', 'w');
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 
130 130
     fputcsv($fp, $header);
131 131
     $user_behavior = Yii::$container->get(\common\interfaces\UserBehaviorInterface::class);
132
-    while($row = $reader->read()) {
132
+    while ($row = $reader->read()) {
133 133
       $row = $user_behavior::decorateWithCategory([$row]);
134 134
       $row = Yii::$app->user->identity->cleanExportData($row);
135 135
       fputcsv($fp, $row[0]);
Please login to merge, or discard this patch.
site/controllers/CheckinController.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
     if ($form->load(Yii::$app->request->post()) && $form->validate()) {
40 40
       $form->compiled_behaviors = $form->compileBehaviors();
41 41
 
42
-      if(sizeof($form->compiled_behaviors) === 0) {
42
+      if (sizeof($form->compiled_behaviors) === 0) {
43 43
         return $this->redirect(['view']);
44 44
       }
45 45
 
@@ -49,14 +49,14 @@  discard block
 block discarded – undo
49 49
 
50 50
       // delete cached scores
51 51
       $time = Yii::$container->get(\common\interfaces\TimeInterface::class);
52
-      $key = "scores_of_last_month_".Yii::$app->user->id."_".$time->getLocalDate();
52
+      $key = "scores_of_last_month_" . Yii::$app->user->id . "_" . $time->getLocalDate();
53 53
       Yii::$app->cache->delete($key);
54 54
 
55 55
       // if the user has publicised their score graph, create the image
56
-      if(Yii::$app->user->identity->expose_graph) {
56
+      if (Yii::$app->user->identity->expose_graph) {
57 57
         $user_behavior = Yii::$container->get(\common\interfaces\UserBehaviorInterface::class);
58 58
         $scores_last_month = $user_behavior->calculateScoresOfLastMonth();
59
-        if($scores_last_month) {
59
+        if ($scores_last_month) {
60 60
           Yii::$container
61 61
             ->get(\common\components\Graph::class, [Yii::$app->user->identity])
62 62
             ->create($scores_last_month, true);
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
     $date = Yii::$container->get(\common\interfaces\TimeInterface::class)->getLocalDate();
82 82
 
83 83
     $user_behaviors = $user_behavior->getUserBehaviorsWithCategory($date);
84
-    if(count($user_behaviors) === 0) {
84
+    if (count($user_behaviors) === 0) {
85 85
       return $this->redirect(['view']);
86 86
     }
87 87
 
@@ -91,10 +91,10 @@  discard block
 block discarded – undo
91 91
       $form->deleteToday();
92 92
 
93 93
       $behaviors = $user_behavior->findAll($form->getUserBehaviorIds());
94
-      if($result = $form->saveAnswers($behaviors)) {
94
+      if ($result = $form->saveAnswers($behaviors)) {
95 95
 
96 96
         $score = $user_behavior->getDailyScore();
97
-        if(Yii::$app->user->identity->isOverThreshold($score)) {
97
+        if (Yii::$app->user->identity->isOverThreshold($score)) {
98 98
           Yii::$app->user->identity->sendEmailReport($date);
99 99
           Yii::$app->session->setFlash('warning', 'Your check-in is complete. A notification has been sent to your report partners because of your high score. Reach out to them!');
100 100
         } else {
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
   public function actionView(string $date = null)
115 115
   {
116 116
     $time = Yii::$container->get(\common\interfaces\TimeInterface::class);
117
-    if(is_null($date)) {
117
+    if (is_null($date)) {
118 118
       $date = $time->getLocalDate();
119
-    } else if($dt = $time->parse($date)) {
119
+    } else if ($dt = $time->parse($date)) {
120 120
       $date = $dt->format('Y-m-d');
121 121
     } else {
122 122
       $date = $time->getLocalDate();
Please login to merge, or discard this patch.