Completed
Pull Request — master (#163)
by Corey
03:24
created
site/controllers/SiteController.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
   public function actionIndex()
72 72
   {
73 73
     $time = Yii::$container->get(\common\interfaces\TimeInterface::class); 
74
-    $key = "index_blog_".$time->getLocalDate('UTC');
74
+    $key = "index_blog_" . $time->getLocalDate('UTC');
75 75
     $posts = Yii::$app->cache->get($key);
76
-    if($posts === false) {
76
+    if ($posts === false) {
77 77
       $posts = \Yii::$app->getModule('blog')
78 78
                             ->fetch()
79 79
                             ->parse()
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
   {
107 107
     $model = new ContactForm();
108 108
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
109
-      if($model->sendEmail(Yii::$app->params['adminEmail'])) {
109
+      if ($model->sendEmail(Yii::$app->params['adminEmail'])) {
110 110
         Yii::$app->session->setFlash('success', 'Thank you for contacting us. We will respond to you as soon as possible.');
111 111
       } else {
112 112
         Yii::$app->session->setFlash('error', 'There was an error sending email.');
@@ -138,10 +138,10 @@  discard block
 block discarded – undo
138 138
   public function actionSignup()
139 139
   {
140 140
     $model = Yii::$container->get(\site\models\SignupForm::class);
141
-    if($model->load(Yii::$app->request->post()) && $model->validate()) {
141
+    if ($model->load(Yii::$app->request->post()) && $model->validate()) {
142 142
       $model->signup();
143 143
       Yii::$app->getSession()->setFlash('success', 'We have sent a verification email to the email address you provided. Please check your inbox and follow the instructions to verify your account.');
144
-      return $this->redirect('/',302);
144
+      return $this->redirect('/', 302);
145 145
     }
146 146
 
147 147
     return $this->render('signup', [
@@ -152,10 +152,10 @@  discard block
 block discarded – undo
152 152
   public function actionRequestPasswordReset()
153 153
   {
154 154
     $model = Yii::$container->get(\site\models\PasswordResetRequestForm::class);
155
-    if($model->load(Yii::$app->request->post()) && $model->validate()) {
156
-      if(!$model->sendEmail()) {
155
+    if ($model->load(Yii::$app->request->post()) && $model->validate()) {
156
+      if (!$model->sendEmail()) {
157 157
         $ip = Yii::$app->getRequest()->getUserIP() ?: "UNKNOWN";
158
-        Yii::warning("$ip has tried to reset the password for ".$model->email);
158
+        Yii::warning("$ip has tried to reset the password for " . $model->email);
159 159
       }
160 160
 
161 161
       Yii::$app->getSession()->setFlash('success', 'If there is an account with the submitted email address you will receive further instructions in your email inbox.');
@@ -198,14 +198,14 @@  discard block
 block discarded – undo
198 198
       throw new BadRequestHttpException("Wrong or expired email verification token. If you aren't sure why this error occurs perhaps you've already verified your account. Please try logging in.");
199 199
     }
200 200
 
201
-    if($user->isTokenConfirmed($user->verify_email_token)) {
201
+    if ($user->isTokenConfirmed($user->verify_email_token)) {
202 202
       Yii::$app->getSession()->setFlash('success', 'Your account has already been verified. Please log in.');
203
-      return $this->redirect('/login',302);
203
+      return $this->redirect('/login', 302);
204 204
     } else if (Yii::$app->getUser()->login($user)) {
205 205
       $user->confirmVerifyEmailToken();
206 206
       $user->save();
207 207
       Yii::$app->getSession()->setFlash('success', 'Your account has been verified. Please continue with your check-in.');
208
-      return $this->redirect('/welcome',302);
208
+      return $this->redirect('/welcome', 302);
209 209
     }
210 210
   }
211 211
 
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
   public function actionExport()
223 223
   {
224 224
     header("Content-Type: text/csv");
225
-    header("Content-Disposition: attachment; filename=fsa-data-export-".Yii::$app->user->identity->email."-".date('Ymd').".csv");
225
+    header("Content-Disposition: attachment; filename=fsa-data-export-" . Yii::$app->user->identity->email . "-" . date('Ymd') . ".csv");
226 226
 
227 227
     $reader = Yii::$app->user->identity->getExportData();
228 228
     $fp = fopen('php://output', 'w');
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 
239 239
     fputcsv($fp, $header);
240 240
     $user_behavior = Yii::$container->get(\common\interfaces\UserBehaviorInterface::class);
241
-    while($row = $reader->read()) {
241
+    while ($row = $reader->read()) {
242 242
       $row = $user_behavior::decorateWithCategory([$row]);
243 243
       $row = Yii::$app->user->identity->cleanExportData($row);
244 244
       fputcsv($fp, $row[0]);
Please login to merge, or discard this patch.
site/views/checkin/old_view.php 4 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@
 block discarded – undo
92 92
     print $form
93 93
             ->field($model, "behaviors{$category['id']}")
94 94
             ->checkboxList($behaviors,
95
-                           ['item' => "checkboxItemTemplate"]);
95
+                            ['item' => "checkboxItemTemplate"]);
96 96
   }
97 97
   ActiveForm::end();
98 98
 
Please login to merge, or discard this patch.
Switch Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -41,10 +41,10 @@
 block discarded – undo
41 41
 
42 42
   <?php
43 43
               switch(true) {
44
-                case ($score < 30):
45
-                  $alert_level = "success";
46
-                  $alert_msg = "You're doing well! Keep on doing whatever it is you're doing!";
47
-                  break;
44
+              case ($score < 30):
45
+                $alert_level = "success";
46
+                $alert_msg = "You're doing well! Keep on doing whatever it is you're doing!";
47
+                break;
48 48
 
49 49
               case ($score < 40):
50 50
                 $alert_level = "info";
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 $this->title = "The Faster Scale App | Previous Check-ins";
16 16
 $time = Yii::$container->get('common\interfaces\TimeInterface');
17 17
 $this->registerJsFile('/js/checkin/view.js', ['depends' => [\site\assets\AppAsset::class]]);
18
-if($answer_pie) {
18
+if ($answer_pie) {
19 19
   $this->registerJsFile('/js/checkin/charts/pie.js', ['depends' => [\site\assets\AppAsset::class]]);
20 20
 }
21 21
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 }
26 26
 
27 27
 $pie_data = [];
28
-if($answer_pie) {
28
+if ($answer_pie) {
29 29
   $values     = array_map('intval', array_column($answer_pie, "count"));
30 30
   $labels     = array_column($answer_pie, "name");
31 31
   $colors     = array_column($answer_pie, "color");
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
   <h1>View Previous Check-ins</h1>
52 52
 
53 53
   <?php
54
-              switch(true) {
54
+              switch (true) {
55 55
                 case ($score < 30):
56 56
                   $alert_level = "success";
57 57
                   $alert_msg = "You're doing well! Keep on doing whatever it is you're doing!";
@@ -112,16 +112,16 @@  discard block
 block discarded – undo
112 112
 </div>
113 113
 
114 114
 
115
-  <?php if($questions) {
115
+  <?php if ($questions) {
116 116
   print "<h3>Processing Questions:</h3>";
117
-  foreach($questions as $behavior_id => $behavior_questions) {
117
+  foreach ($questions as $behavior_id => $behavior_questions) {
118 118
     print "<div class='well well-sm'>";
119 119
     print "<button type='button' class='btn btn-primary' disabled='disabled'>{$behavior_questions['question']['title']}</button>";
120 120
     print "<div class='row'>";
121
-    foreach($behavior_questions['answers'] as $question) { 
121
+    foreach ($behavior_questions['answers'] as $question) { 
122 122
       print "<div class='col-md-4'>";
123 123
       print "<p><strong>{$question['title']}</strong></p>";
124
-      print "<p>".Html::encode($question['answer'])."</p>";
124
+      print "<p>" . Html::encode($question['answer']) . "</p>";
125 125
       print "</div>";
126 126
     }
127 127
     print "</div></div>";
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
     'options' => ['class' => 'form-horizontal'],
137 137
   ]);
138 138
 
139
-  foreach($categories as $category) {
139
+  foreach ($categories as $category) {
140 140
     $behaviors = AH::map($behaviorsList[$category['id']], 'id', 'name');
141 141
     print $form
142 142
             ->field($model, "behaviors{$category['id']}")
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
   ActiveForm::end();
147 147
 
148 148
 $this->registerJson($past_checkin_dates, "past-checkin-dates");
149
-if($answer_pie) {
149
+if ($answer_pie) {
150 150
   $this->registerJson($pie_data, "pie_data");
151 151
 }
152 152
 ?>
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -102,9 +102,12 @@
 block discarded – undo
102 102
         <div class='card-text'>
103 103
           <?php if ($pie_data): ?>
104 104
           <canvas id='category-pie-chart'></canvas>
105
-          <?php else: ?>
105
+          <?php else {
106
+  : ?>
106 107
           <p>no data</p>
107
-          <?php endif; ?>
108
+          <?php endif;
109
+}
110
+?>
108 111
         </div>
109 112
       </div>
110 113
     </div>
Please login to merge, or discard this patch.
site/controllers/CheckinController.php 1 patch
Spacing   +6 added lines, -6 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
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     $date = Yii::$container->get(\common\interfaces\TimeInterface::class)->getLocalDate();
66 66
 
67 67
     $user_behaviors = $user_behavior->getUserBehaviorsWithCategory($date);
68
-    if(count($user_behaviors) === 0) {
68
+    if (count($user_behaviors) === 0) {
69 69
       return $this->redirect(['view']);
70 70
     }
71 71
 
@@ -75,9 +75,9 @@  discard block
 block discarded – undo
75 75
       $form->deleteToday();
76 76
 
77 77
       $behaviors = $user_behavior->findAll($form->getUserBehaviorIds());
78
-      if($result = $form->saveAnswers($behaviors)) {
78
+      if ($result = $form->saveAnswers($behaviors)) {
79 79
 
80
-        if(Yii::$app->user->identity->send_email) {
80
+        if (Yii::$app->user->identity->send_email) {
81 81
           Yii::$app->user->identity->sendEmailReport($date);
82 82
           Yii::$app->session->setFlash('success', 'Your check-in is complete. A notification has been sent to your report partners.');
83 83
         } else {
@@ -97,9 +97,9 @@  discard block
 block discarded – undo
97 97
   public function actionView(string $date = null)
98 98
   {
99 99
     $time = Yii::$container->get(\common\interfaces\TimeInterface::class);
100
-    if(is_null($date)) {
100
+    if (is_null($date)) {
101 101
       $date = $time->getLocalDate();
102
-    } else if($dt = $time->parse($date)) {
102
+    } else if ($dt = $time->parse($date)) {
103 103
       $date = $dt->format('Y-m-d');
104 104
     } else {
105 105
       $date = $time->getLocalDate();
Please login to merge, or discard this patch.
site/models/SignupForm.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
    */
83 83
   public function signup() {
84 84
     $user = $this->user->findByEmail($this->email);
85
-    if(!$user) {
85
+    if (!$user) {
86 86
       // this is a brand new user
87 87
       $this->user = $this->setFields($this->user);
88 88
       $this->user->save();
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
        * this is a user that for whatever reason is trying to sign up again
97 97
        * with the same email address.
98 98
        */
99
-      if(!$user->isTokenConfirmed()) {
99
+      if (!$user->isTokenConfirmed()) {
100 100
         /*
101 101
          * they've never verified their account. We don't care if their
102 102
          * verification token is current or expired. We're resetting their
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
       $user->generateAuthKey();
125 125
       $user->generateVerifyEmailToken();
126 126
 
127
-      if($user->send_email) {
127
+      if ($user->send_email) {
128 128
         $user->partner_email1  = $this->partner_email1;
129 129
         $user->partner_email2  = $this->partner_email2;
130 130
         $user->partner_email3  = $this->partner_email3;
Please login to merge, or discard this patch.
common/tests/unit/models/UserBehaviorTest.php 2 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -89,19 +89,19 @@
 block discarded – undo
89 89
     expect('decorate should add Behavior data and Category data to an array of UserBehaviors',
90 90
       $this->assertEquals(
91 91
         $this->user_behavior->decorateWithCategory($this->singleSimpleBehaviorNoBehavior),
92
-         [['id' => 396,
93
-           'user_id' => 2,
94
-           'behavior_id' => 107,
95
-           'date' => '2016-06-17 04:12:43',
96
-           'behavior' => [
97
-             'id' => 107,
98
-             'name' => 'numb',
99
-             'category_id' => 6,
100
-             'category' => [
101
-               'id' => 6,
102
-               'name' => 'Exhausted',
103
-             ]
104
-           ]]]));
92
+          [['id' => 396,
93
+            'user_id' => 2,
94
+            'behavior_id' => 107,
95
+            'date' => '2016-06-17 04:12:43',
96
+            'behavior' => [
97
+              'id' => 107,
98
+              'name' => 'numb',
99
+              'category_id' => 6,
100
+              'category' => [
101
+                'id' => 6,
102
+                'name' => 'Exhausted',
103
+              ]
104
+            ]]]));
105 105
   }
106 106
 
107 107
   public function testGetTopBehaviors() {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
   ]; 
34 34
   public function setUp() {
35 35
     // pull in test data
36
-    $data = require(__DIR__.'/../data/checkinData.php');
36
+    $data = require(__DIR__ . '/../data/checkinData.php');
37 37
     $this->singleBhvr = $data['singleBhvr'];
38 38
     $this->manyBhvrs = $data['manyBhvrs'];
39 39
     $this->allBhvrs = $data['allBhvrs'];
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     $this->container->set('common\interfaces\UserInterface', '\site\tests\_support\MockUser');
44 44
     $this->container->set('common\interfaces\QuestionInterface', '\site\tests\_support\MockQuestion');
45 45
     $this->container->set('common\interfaces\BehaviorInterface', 'common\models\Behavior');
46
-    $this->container->set('common\interfaces\TimeInterface', function () {
46
+    $this->container->set('common\interfaces\TimeInterface', function() {
47 47
         return new \common\components\Time('America/Los_Angeles');
48 48
       });
49 49
 
Please login to merge, or discard this patch.
common/tests/unit/models/BehaviorTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
 
21 21
     expect('getCategories should return an array of 7 categories', $this->assertEquals(count($behaviors), 7));
22 22
 
23
-    foreach($behaviors as $behavior) {
23
+    foreach ($behaviors as $behavior) {
24 24
       expect('this behavior to have a "name" key', $this->assertArrayHasKey('name', $behavior));
25 25
       expect('this behavior to have a "behavior_count" key', $this->assertArrayHasKey('behavior_count', $behavior));
26 26
       expect('this behavior to have a "category_id" key', $this->assertArrayHasKey('category_id', $behavior));
Please login to merge, or discard this patch.
common/tests/unit/models/UserTest.php 2 patches
Indentation   +624 added lines, -624 removed lines patch added patch discarded remove patch
@@ -17,640 +17,640 @@
 block discarded – undo
17 17
 
18 18
   private $user;
19 19
 
20
-	public $questionData = [
21
-	[
22
-		'id' => 641,
23
-		'user_id' => 2,
24
-		'behavior_id' => 13,
25
-		'user_behavior_id' => 821,
26
-		'question' => 1,
27
-		'answer' => 'alsgn',
28
-		'date' => '2016-09-10 19:27:43',
29
-		'behavior' => 
30
-		[
31
-			'id' => 13,
32
-			'name' => 'less time/energy for God, meetings, and church',
33
-			'category_id' => 2,
34
-		],
35
-	],
36
-	[
37
-		'id' => 642,
38
-		'user_id' => 2,
39
-		'behavior_id' => 13,
40
-		'user_behavior_id' => 821,
41
-		'question' => 2,
42
-		'answer' => 'loiun',
43
-		'date' => '2016-09-10 19:27:43',
44
-		'behavior' => 
45
-		[
46
-			'id' => 13,
47
-			'name' => 'less time/energy for God, meetings, and church',
48
-			'category_id' => 2,
49
-		],
50
-	],
51
-	[
52
-		'id' => 643,
53
-		'user_id' => 2,
54
-		'behavior_id' => 13,
55
-		'user_behavior_id' => 821,
56
-		'question' => 3,
57
-		'answer' => 'liun',
58
-		'date' => '2016-09-10 19:27:43',
59
-		'behavior' => 
60
-		[
61
-			'id' => 13,
62
-			'name' => 'less time/energy for God, meetings, and church',
63
-			'category_id' => 2,
64
-		],
65
-	],
66
-	[
67
-		'id' => 644,
68
-		'user_id' => 2,
69
-		'behavior_id' => 29,
70
-		'user_behavior_id' => 823,
71
-		'question' => 1,
72
-		'answer' => 'ljnb',
73
-		'date' => '2016-09-10 19:27:43',
74
-		'behavior' => 
75
-		[
76
-			'id' => 29,
77
-			'name' => 'using profanity',
78
-			'category_id' => 3,
79
-		],
80
-	],
81
-	[
82
-		'id' => 645,
83
-		'user_id' => 2,
84
-		'behavior_id' => 29,
85
-		'user_behavior_id' => 823,
86
-		'question' => 2,
87
-		'answer' => 'liunb',
88
-		'date' => '2016-09-10 19:27:43',
89
-		'behavior' => 
90
-		[
91
-			'id' => 29,
92
-			'name' => 'using profanity',
93
-			'category_id' => 3,
94
-		],
95
-	],
96
-	[
97
-		'id' => 646,
98
-		'user_id' => 2,
99
-		'behavior_id' => 29,
100
-		'user_behavior_id' => 823,
101
-		'question' => 3,
102
-		'answer' => 'ilub ',
103
-		'date' => '2016-09-10 19:27:43',
104
-		'behavior' => 
105
-		[
106
-			'id' => 29,
107
-			'name' => 'using profanity',
108
-			'category_id' => 3,
109
-		],
110
-	],
111
-	[
112
-		'id' => 647,
113
-		'user_id' => 2,
114
-		'behavior_id' => 48,
115
-		'user_behavior_id' => 825,
116
-		'question' => 1,
117
-		'answer' => 'liub',
118
-		'date' => '2016-09-10 19:27:43',
119
-		'behavior' => 
120
-		[
121
-			'id' => 48,
122
-			'name' => 'workaholic',
123
-			'category_id' => 4,
124
-		],
125
-	],
126
-	[
127
-		'id' => 648,
128
-		'user_id' => 2,
129
-		'behavior_id' => 48,
130
-		'user_behavior_id' => 825,
131
-		'question' => 2,
132
-		'answer' => 'liub',
133
-		'date' => '2016-09-10 19:27:43',
134
-		'behavior' => 
135
-		[
136
-			'id' => 48,
137
-			'name' => 'workaholic',
138
-			'category_id' => 4,
139
-		],
140
-	],
141
-	[
142
-		'id' => 649,
143
-		'user_id' => 2,
144
-		'behavior_id' => 48,
145
-		'user_behavior_id' => 825,
146
-		'question' => 3,
147
-		'answer' => 'liub ',
148
-		'date' => '2016-09-10 19:27:43',
149
-		'behavior' => 
150
-		[
151
-			'id' => 48,
152
-			'name' => 'workaholic',
153
-			'category_id' => 4,
154
-		],
155
-	],
156
-	[
157
-		'id' => 650,
158
-		'user_id' => 2,
159
-		'behavior_id' => 89,
160
-		'user_behavior_id' => 828,
161
-		'question' => 1,
162
-		'answer' => 'liub',
163
-		'date' => '2016-09-10 19:27:43',
164
-		'behavior' => 
165
-		[
166
-			'id' => 89,
167
-			'name' => 'obsessive (stuck) thoughts',
168
-			'category_id' => 5,
169
-		],
170
-	],
171
-	[
172
-		'id' => 651,
173
-		'user_id' => 2,
174
-		'behavior_id' => 89,
175
-		'user_behavior_id' => 828,
176
-		'question' => 2,
177
-		'answer' => 'liuby',
178
-		'date' => '2016-09-10 19:27:43',
179
-		'behavior' => 
180
-		[
181
-			'id' => 89,
182
-			'name' => 'obsessive (stuck) thoughts',
183
-			'category_id' => 5,
184
-		],
185
-	],
186
-	[
187
-		'id' => 652,
188
-		'user_id' => 2,
189
-		'behavior_id' => 89,
190
-		'user_behavior_id' => 828,
191
-		'question' => 3,
192
-		'answer' => 'uiylb',
193
-		'date' => '2016-09-10 19:27:43',
194
-		'behavior' => 
195
-		[
196
-			'id' => 89,
197
-			'name' => 'obsessive (stuck) thoughts',
198
-			'category_id' => 5,
199
-		],
200
-	],
201
-	[
202
-		'id' => 653,
203
-		'user_id' => 2,
204
-		'behavior_id' => 111,
205
-		'user_behavior_id' => 829,
206
-		'question' => 1,
207
-		'answer' => 'liub',
208
-		'date' => '2016-09-10 19:27:43',
209
-		'behavior' => 
210
-		[
211
-			'id' => 111,
212
-			'name' => 'seeking out old unhealthy people and places',
213
-			'category_id' => 6,
214
-		],
215
-	],
216
-	[
217
-		'id' => 654,
218
-		'user_id' => 2,
219
-		'behavior_id' => 111,
220
-		'user_behavior_id' => 829,
221
-		'question' => 2,
222
-		'answer' => 'liuyb',
223
-		'date' => '2016-09-10 19:27:43',
224
-		'behavior' => 
225
-		[
226
-			'id' => 111,
227
-			'name' => 'seeking out old unhealthy people and places',
228
-			'category_id' => 6,
229
-		],
230
-	],
231
-	[
232
-		'id' => 655,
233
-		'user_id' => 2,
234
-		'behavior_id' => 111,
235
-		'user_behavior_id' => 829,
236
-		'question' => 3,
237
-		'answer' => 'iuyb',
238
-		'date' => '2016-09-10 19:27:43',
239
-		'behavior' => 
240
-		[
241
-			'id' => 111,
242
-			'name' => 'seeking out old unhealthy people and places',
243
-			'category_id' => 6,
244
-		],
245
-	],
246
-	[
247
-		'id' => 656,
248
-		'user_id' => 2,
249
-		'behavior_id' => 122,
250
-		'user_behavior_id' => 831,
251
-		'question' => 1,
252
-		'answer' => 'iuyb',
253
-		'date' => '2016-09-10 19:27:43',
254
-		'behavior' => 
255
-		[
256
-			'id' => 122,
257
-			'name' => 'returning to the place you swore you would never go again',
258
-			'category_id' => 7,
259
-		],
260
-	],
261
-	[
262
-		'id' => 657,
263
-		'user_id' => 2,
264
-		'behavior_id' => 122,
265
-		'user_behavior_id' => 831,
266
-		'question' => 2,
267
-		'answer' => 'iuyb',
268
-		'date' => '2016-09-10 19:27:43',
269
-		'behavior' => 
270
-		[
271
-			'id' => 122,
272
-			'name' => 'returning to the place you swore you would never go again',
273
-			'category_id' => 7,
274
-		],
275
-	],
276
-	[
277
-		'id' => 658,
278
-		'user_id' => 2,
279
-		'behavior_id' => 122,
280
-		'user_behavior_id' => 831,
281
-		'question' => 3,
282
-		'answer' => 'liuyb',
283
-		'date' => '2016-09-10 19:27:43',
284
-		'behavior' => 
285
-		[
286
-			'id' => 122,
287
-			'name' => 'returning to the place you swore you would never go again',
288
-			'category_id' => 7,
289
-		],
290
-	],
20
+  public $questionData = [
21
+  [
22
+    'id' => 641,
23
+    'user_id' => 2,
24
+    'behavior_id' => 13,
25
+    'user_behavior_id' => 821,
26
+    'question' => 1,
27
+    'answer' => 'alsgn',
28
+    'date' => '2016-09-10 19:27:43',
29
+    'behavior' => 
30
+    [
31
+      'id' => 13,
32
+      'name' => 'less time/energy for God, meetings, and church',
33
+      'category_id' => 2,
34
+    ],
35
+  ],
36
+  [
37
+    'id' => 642,
38
+    'user_id' => 2,
39
+    'behavior_id' => 13,
40
+    'user_behavior_id' => 821,
41
+    'question' => 2,
42
+    'answer' => 'loiun',
43
+    'date' => '2016-09-10 19:27:43',
44
+    'behavior' => 
45
+    [
46
+      'id' => 13,
47
+      'name' => 'less time/energy for God, meetings, and church',
48
+      'category_id' => 2,
49
+    ],
50
+  ],
51
+  [
52
+    'id' => 643,
53
+    'user_id' => 2,
54
+    'behavior_id' => 13,
55
+    'user_behavior_id' => 821,
56
+    'question' => 3,
57
+    'answer' => 'liun',
58
+    'date' => '2016-09-10 19:27:43',
59
+    'behavior' => 
60
+    [
61
+      'id' => 13,
62
+      'name' => 'less time/energy for God, meetings, and church',
63
+      'category_id' => 2,
64
+    ],
65
+  ],
66
+  [
67
+    'id' => 644,
68
+    'user_id' => 2,
69
+    'behavior_id' => 29,
70
+    'user_behavior_id' => 823,
71
+    'question' => 1,
72
+    'answer' => 'ljnb',
73
+    'date' => '2016-09-10 19:27:43',
74
+    'behavior' => 
75
+    [
76
+      'id' => 29,
77
+      'name' => 'using profanity',
78
+      'category_id' => 3,
79
+    ],
80
+  ],
81
+  [
82
+    'id' => 645,
83
+    'user_id' => 2,
84
+    'behavior_id' => 29,
85
+    'user_behavior_id' => 823,
86
+    'question' => 2,
87
+    'answer' => 'liunb',
88
+    'date' => '2016-09-10 19:27:43',
89
+    'behavior' => 
90
+    [
91
+      'id' => 29,
92
+      'name' => 'using profanity',
93
+      'category_id' => 3,
94
+    ],
95
+  ],
96
+  [
97
+    'id' => 646,
98
+    'user_id' => 2,
99
+    'behavior_id' => 29,
100
+    'user_behavior_id' => 823,
101
+    'question' => 3,
102
+    'answer' => 'ilub ',
103
+    'date' => '2016-09-10 19:27:43',
104
+    'behavior' => 
105
+    [
106
+      'id' => 29,
107
+      'name' => 'using profanity',
108
+      'category_id' => 3,
109
+    ],
110
+  ],
111
+  [
112
+    'id' => 647,
113
+    'user_id' => 2,
114
+    'behavior_id' => 48,
115
+    'user_behavior_id' => 825,
116
+    'question' => 1,
117
+    'answer' => 'liub',
118
+    'date' => '2016-09-10 19:27:43',
119
+    'behavior' => 
120
+    [
121
+      'id' => 48,
122
+      'name' => 'workaholic',
123
+      'category_id' => 4,
124
+    ],
125
+  ],
126
+  [
127
+    'id' => 648,
128
+    'user_id' => 2,
129
+    'behavior_id' => 48,
130
+    'user_behavior_id' => 825,
131
+    'question' => 2,
132
+    'answer' => 'liub',
133
+    'date' => '2016-09-10 19:27:43',
134
+    'behavior' => 
135
+    [
136
+      'id' => 48,
137
+      'name' => 'workaholic',
138
+      'category_id' => 4,
139
+    ],
140
+  ],
141
+  [
142
+    'id' => 649,
143
+    'user_id' => 2,
144
+    'behavior_id' => 48,
145
+    'user_behavior_id' => 825,
146
+    'question' => 3,
147
+    'answer' => 'liub ',
148
+    'date' => '2016-09-10 19:27:43',
149
+    'behavior' => 
150
+    [
151
+      'id' => 48,
152
+      'name' => 'workaholic',
153
+      'category_id' => 4,
154
+    ],
155
+  ],
156
+  [
157
+    'id' => 650,
158
+    'user_id' => 2,
159
+    'behavior_id' => 89,
160
+    'user_behavior_id' => 828,
161
+    'question' => 1,
162
+    'answer' => 'liub',
163
+    'date' => '2016-09-10 19:27:43',
164
+    'behavior' => 
165
+    [
166
+      'id' => 89,
167
+      'name' => 'obsessive (stuck) thoughts',
168
+      'category_id' => 5,
169
+    ],
170
+  ],
171
+  [
172
+    'id' => 651,
173
+    'user_id' => 2,
174
+    'behavior_id' => 89,
175
+    'user_behavior_id' => 828,
176
+    'question' => 2,
177
+    'answer' => 'liuby',
178
+    'date' => '2016-09-10 19:27:43',
179
+    'behavior' => 
180
+    [
181
+      'id' => 89,
182
+      'name' => 'obsessive (stuck) thoughts',
183
+      'category_id' => 5,
184
+    ],
185
+  ],
186
+  [
187
+    'id' => 652,
188
+    'user_id' => 2,
189
+    'behavior_id' => 89,
190
+    'user_behavior_id' => 828,
191
+    'question' => 3,
192
+    'answer' => 'uiylb',
193
+    'date' => '2016-09-10 19:27:43',
194
+    'behavior' => 
195
+    [
196
+      'id' => 89,
197
+      'name' => 'obsessive (stuck) thoughts',
198
+      'category_id' => 5,
199
+    ],
200
+  ],
201
+  [
202
+    'id' => 653,
203
+    'user_id' => 2,
204
+    'behavior_id' => 111,
205
+    'user_behavior_id' => 829,
206
+    'question' => 1,
207
+    'answer' => 'liub',
208
+    'date' => '2016-09-10 19:27:43',
209
+    'behavior' => 
210
+    [
211
+      'id' => 111,
212
+      'name' => 'seeking out old unhealthy people and places',
213
+      'category_id' => 6,
214
+    ],
215
+  ],
216
+  [
217
+    'id' => 654,
218
+    'user_id' => 2,
219
+    'behavior_id' => 111,
220
+    'user_behavior_id' => 829,
221
+    'question' => 2,
222
+    'answer' => 'liuyb',
223
+    'date' => '2016-09-10 19:27:43',
224
+    'behavior' => 
225
+    [
226
+      'id' => 111,
227
+      'name' => 'seeking out old unhealthy people and places',
228
+      'category_id' => 6,
229
+    ],
230
+  ],
231
+  [
232
+    'id' => 655,
233
+    'user_id' => 2,
234
+    'behavior_id' => 111,
235
+    'user_behavior_id' => 829,
236
+    'question' => 3,
237
+    'answer' => 'iuyb',
238
+    'date' => '2016-09-10 19:27:43',
239
+    'behavior' => 
240
+    [
241
+      'id' => 111,
242
+      'name' => 'seeking out old unhealthy people and places',
243
+      'category_id' => 6,
244
+    ],
245
+  ],
246
+  [
247
+    'id' => 656,
248
+    'user_id' => 2,
249
+    'behavior_id' => 122,
250
+    'user_behavior_id' => 831,
251
+    'question' => 1,
252
+    'answer' => 'iuyb',
253
+    'date' => '2016-09-10 19:27:43',
254
+    'behavior' => 
255
+    [
256
+      'id' => 122,
257
+      'name' => 'returning to the place you swore you would never go again',
258
+      'category_id' => 7,
259
+    ],
260
+  ],
261
+  [
262
+    'id' => 657,
263
+    'user_id' => 2,
264
+    'behavior_id' => 122,
265
+    'user_behavior_id' => 831,
266
+    'question' => 2,
267
+    'answer' => 'iuyb',
268
+    'date' => '2016-09-10 19:27:43',
269
+    'behavior' => 
270
+    [
271
+      'id' => 122,
272
+      'name' => 'returning to the place you swore you would never go again',
273
+      'category_id' => 7,
274
+    ],
275
+  ],
276
+  [
277
+    'id' => 658,
278
+    'user_id' => 2,
279
+    'behavior_id' => 122,
280
+    'user_behavior_id' => 831,
281
+    'question' => 3,
282
+    'answer' => 'liuyb',
283
+    'date' => '2016-09-10 19:27:43',
284
+    'behavior' => 
285
+    [
286
+      'id' => 122,
287
+      'name' => 'returning to the place you swore you would never go again',
288
+      'category_id' => 7,
289
+    ],
290
+  ],
291 291
 ];
292 292
 public $userQuestions = [
293
-	13 => [
294
-		'question' => [
295
-			'id' => 13,
296
-			'title' => 'less time/energy for God, meetings, and church',
297
-		],
298
-		'answers' => [
299
-			[
300
-				'title' => 'How does it affect me? How do I act and feel?',
301
-				'answer' => 'alsgn',
302
-			], [
303
-				'title' => 'How does it affect the important people in my life?',
304
-				'answer' => 'loiun',
305
-			], [
306
-				'title' => 'Why do I do this? What is the benefit for me?',
307
-				'answer' => 'liun',
308
-			],
309
-		],
310
-	],
311
-	29 => [
312
-		'question' => [
313
-			'id' => 29,
314
-			'title' => 'using profanity',
315
-		],
316
-		'answers' => [
317
-			[
318
-				'title' => 'How does it affect me? How do I act and feel?',
319
-				'answer' => 'ljnb',
320
-			], [
321
-				'title' => 'How does it affect the important people in my life?',
322
-				'answer' => 'liunb',
323
-			], [
324
-				'title' => 'Why do I do this? What is the benefit for me?',
325
-				'answer' => 'ilub ',
326
-			],
327
-		],
328
-	],
329
-	48 => [
330
-		'question' => [
331
-			'id' => 48,
332
-			'title' => 'workaholic',
333
-		],
334
-		'answers' => [
335
-			[
336
-				'title' => 'How does it affect me? How do I act and feel?',
337
-				'answer' => 'liub',
338
-			], [
339
-				'title' => 'How does it affect the important people in my life?',
340
-				'answer' => 'liub',
341
-			], [
342
-				'title' => 'Why do I do this? What is the benefit for me?',
343
-				'answer' => 'liub ',
344
-			],
345
-		],
346
-	],
347
-	89 => [
348
-		'question' => [
349
-			'id' => 89,
350
-			'title' => 'obsessive (stuck) thoughts',
351
-		],
352
-		'answers' => [
353
-			[
354
-				'title' => 'How does it affect me? How do I act and feel?',
355
-				'answer' => 'liub',
356
-			], [
357
-				'title' => 'How does it affect the important people in my life?',
358
-				'answer' => 'liuby',
359
-			], [
360
-				'title' => 'Why do I do this? What is the benefit for me?',
361
-				'answer' => 'uiylb',
362
-			],
363
-		],
364
-	],
365
-	111 => [
366
-		'question' => [
367
-			'id' => 111,
368
-			'title' => 'seeking out old unhealthy people and places',
369
-		],
370
-		'answers' => [
371
-			[
372
-				'title' => 'How does it affect me? How do I act and feel?',
373
-				'answer' => 'liub',
374
-			], [
375
-				'title' => 'How does it affect the important people in my life?',
376
-				'answer' => 'liuyb',
377
-			], [
378
-				'title' => 'Why do I do this? What is the benefit for me?',
379
-				'answer' => 'iuyb',
380
-			],
381
-		],
382
-	],
383
-	122 => [
384
-		'question' => [
385
-			'id' => 122,
386
-			'title' => 'returning to the place you swore you would never go again',
387
-		],
388
-		'answers' => [
389
-			[
390
-				'title' => 'How does it affect me? How do I act and feel?',
391
-				'answer' => 'iuyb',
392
-			], [
393
-				'title' => 'How does it affect the important people in my life?',
394
-				'answer' => 'iuyb',
395
-			], [
396
-				'title' => 'Why do I do this? What is the benefit for me?',
397
-				'answer' => 'liuyb',
398
-			],
399
-		],
400
-	],
293
+  13 => [
294
+    'question' => [
295
+      'id' => 13,
296
+      'title' => 'less time/energy for God, meetings, and church',
297
+    ],
298
+    'answers' => [
299
+      [
300
+        'title' => 'How does it affect me? How do I act and feel?',
301
+        'answer' => 'alsgn',
302
+      ], [
303
+        'title' => 'How does it affect the important people in my life?',
304
+        'answer' => 'loiun',
305
+      ], [
306
+        'title' => 'Why do I do this? What is the benefit for me?',
307
+        'answer' => 'liun',
308
+      ],
309
+    ],
310
+  ],
311
+  29 => [
312
+    'question' => [
313
+      'id' => 29,
314
+      'title' => 'using profanity',
315
+    ],
316
+    'answers' => [
317
+      [
318
+        'title' => 'How does it affect me? How do I act and feel?',
319
+        'answer' => 'ljnb',
320
+      ], [
321
+        'title' => 'How does it affect the important people in my life?',
322
+        'answer' => 'liunb',
323
+      ], [
324
+        'title' => 'Why do I do this? What is the benefit for me?',
325
+        'answer' => 'ilub ',
326
+      ],
327
+    ],
328
+  ],
329
+  48 => [
330
+    'question' => [
331
+      'id' => 48,
332
+      'title' => 'workaholic',
333
+    ],
334
+    'answers' => [
335
+      [
336
+        'title' => 'How does it affect me? How do I act and feel?',
337
+        'answer' => 'liub',
338
+      ], [
339
+        'title' => 'How does it affect the important people in my life?',
340
+        'answer' => 'liub',
341
+      ], [
342
+        'title' => 'Why do I do this? What is the benefit for me?',
343
+        'answer' => 'liub ',
344
+      ],
345
+    ],
346
+  ],
347
+  89 => [
348
+    'question' => [
349
+      'id' => 89,
350
+      'title' => 'obsessive (stuck) thoughts',
351
+    ],
352
+    'answers' => [
353
+      [
354
+        'title' => 'How does it affect me? How do I act and feel?',
355
+        'answer' => 'liub',
356
+      ], [
357
+        'title' => 'How does it affect the important people in my life?',
358
+        'answer' => 'liuby',
359
+      ], [
360
+        'title' => 'Why do I do this? What is the benefit for me?',
361
+        'answer' => 'uiylb',
362
+      ],
363
+    ],
364
+  ],
365
+  111 => [
366
+    'question' => [
367
+      'id' => 111,
368
+      'title' => 'seeking out old unhealthy people and places',
369
+    ],
370
+    'answers' => [
371
+      [
372
+        'title' => 'How does it affect me? How do I act and feel?',
373
+        'answer' => 'liub',
374
+      ], [
375
+        'title' => 'How does it affect the important people in my life?',
376
+        'answer' => 'liuyb',
377
+      ], [
378
+        'title' => 'Why do I do this? What is the benefit for me?',
379
+        'answer' => 'iuyb',
380
+      ],
381
+    ],
382
+  ],
383
+  122 => [
384
+    'question' => [
385
+      'id' => 122,
386
+      'title' => 'returning to the place you swore you would never go again',
387
+    ],
388
+    'answers' => [
389
+      [
390
+        'title' => 'How does it affect me? How do I act and feel?',
391
+        'answer' => 'iuyb',
392
+      ], [
393
+        'title' => 'How does it affect the important people in my life?',
394
+        'answer' => 'iuyb',
395
+      ], [
396
+        'title' => 'Why do I do this? What is the benefit for me?',
397
+        'answer' => 'liuyb',
398
+      ],
399
+    ],
400
+  ],
401 401
 ];
402 402
 
403 403
 public $behaviorData = [
404
-	[
405
-		'id' => 820,
406
-		'user_id' => 2,
407
-		'behavior_id' => 7,
408
-		'date' => '2016-09-10 19:26:04',
409
-		'behavior' => [
410
-			'id' => 7,
411
-			'name' => 'making eye contact',
412
-			'category_id' => 1,
413
-			'category' => [
414
-				'id' => 1,
415
-				'name' => 'Restoration',
416
-			],
417
-		],
418
-	], [
419
-		'id' => 821,
420
-		'user_id' => 2,
421
-		'behavior_id' => 13,
422
-		'date' => '2016-09-10 19:26:04',
423
-		'behavior' => [
424
-			'id' => 13,
425
-			'name' => 'less time/energy for God, meetings, and church',
426
-			'category_id' => 2,
427
-			'category' => [
428
-				'id' => 2,
429
-				'name' => 'Forgetting Priorities',
430
-			],
431
-		],
432
-	], [
433
-		'id' => 822,
434
-		'user_id' => 2,
435
-		'behavior_id' => 18,
436
-		'date' => '2016-09-10 19:26:04',
437
-		'behavior' => [
438
-			'id' => 18,
439
-			'name' => 'changes in goals',
440
-			'category_id' => 2,
441
-			'category' => [
442
-				'id' => 2,
443
-				'name' => 'Forgetting Priorities',
444
-			],
445
-		],
446
-	], [
447
-		'id' => 823,
448
-		'user_id' => 2,
449
-		'behavior_id' => 29,
450
-		'date' => '2016-09-10 19:26:04',
451
-		'behavior' => [
452
-			'id' => 29,
453
-			'name' => 'using profanity',
454
-			'category_id' => 3,
455
-			'category' => [
456
-				'id' => 3,
457
-				'name' => 'Anxiety',
458
-			],
459
-		],
460
-	], [
461
-		'id' => 824,
462
-		'user_id' => 2,
463
-		'behavior_id' => 41,
464
-		'date' => '2016-09-10 19:26:04',
465
-		'behavior' => [
466
-			'id' => 41,
467
-			'name' => 'co-dependent rescuing',
468
-			'category_id' => 3,
469
-			'category' => [
470
-				'id' => 3,
471
-				'name' => 'Anxiety',
472
-			],
473
-		],
474
-	], [
475
-		'id' => 825,
476
-		'user_id' => 2,
477
-		'behavior_id' => 48,
478
-		'date' => '2016-09-10 19:26:04',
479
-		'behavior' => [
480
-			'id' => 48,
481
-			'name' => 'workaholic',
482
-			'category_id' => 4,
483
-			'category' => [
484
-				'id' => 4,
485
-				'name' => 'Speeding Up',
486
-			],
487
-		],
488
-	], [
489
-		'id' => 826,
490
-		'user_id' => 2,
491
-		'behavior_id' => 72,
492
-		'date' => '2016-09-10 19:26:04',
493
-		'behavior' => [
494
-			'id' => 72,
495
-			'name' => 'black and white, all or nothing thinking',
496
-			'category_id' => 5,
497
-			'category' => [
498
-				'id' => 5,
499
-				'name' => 'Ticked Off',
500
-			],
501
-		],
502
-	], [
503
-		'id' => 827,
504
-		'user_id' => 2,
505
-		'behavior_id' => 79,
506
-		'date' => '2016-09-10 19:26:04',
507
-		'behavior' => [
508
-			'id' => 79,
509
-			'name' => 'blaming',
510
-			'category_id' => 5,
511
-			'category' => [
512
-				'id' => 5,
513
-				'name' => 'Ticked Off',
514
-			],
515
-		],
516
-	], [
517
-		'id' => 828,
518
-		'user_id' => 2,
519
-		'behavior_id' => 89,
520
-		'date' => '2016-09-10 19:26:04',
521
-		'behavior' => [
522
-			'id' => 89,
523
-			'name' => 'obsessive (stuck) thoughts',
524
-			'category_id' => 5,
525
-			'category' => [
526
-				'id' => 5,
527
-				'name' => 'Ticked Off',
528
-			],
529
-		],
530
-	], [
531
-		'id' => 829,
532
-		'user_id' => 2,
533
-		'behavior_id' => 111,
534
-		'date' => '2016-09-10 19:26:04',
535
-		'behavior' => [
536
-			'id' => 111,
537
-			'name' => 'seeking out old unhealthy people and places',
538
-			'category_id' => 6,
539
-			'category' => [
540
-				'id' => 6,
541
-				'name' => 'Exhausted',
542
-			],
543
-		],
544
-	], [
545
-		'id' => 830,
546
-		'user_id' => 2,
547
-		'behavior_id' => 118,
548
-		'date' => '2016-09-10 19:26:04',
549
-		'behavior' => [
550
-			'id' => 118,
551
-			'name' => 'not returning phone calls',
552
-			'category_id' => 6,
553
-			'category' => [
554
-				'id' => 6,
555
-				'name' => 'Exhausted',
556
-			],
557
-		],
558
-	], [
559
-		'id' => 831,
560
-		'user_id' => 2,
561
-		'behavior_id' => 122,
562
-		'date' => '2016-09-10 19:26:04',
563
-		'behavior' => [
564
-			'id' => 122,
565
-			'name' => 'returning to the place you swore you would never go again',
566
-			'category_id' => 7,
567
-			'category' => [
568
-				'id' => 7,
569
-				'name' => 'Relapse/Moral Failure',
570
-			],
571
-		],
572
-	],
404
+  [
405
+    'id' => 820,
406
+    'user_id' => 2,
407
+    'behavior_id' => 7,
408
+    'date' => '2016-09-10 19:26:04',
409
+    'behavior' => [
410
+      'id' => 7,
411
+      'name' => 'making eye contact',
412
+      'category_id' => 1,
413
+      'category' => [
414
+        'id' => 1,
415
+        'name' => 'Restoration',
416
+      ],
417
+    ],
418
+  ], [
419
+    'id' => 821,
420
+    'user_id' => 2,
421
+    'behavior_id' => 13,
422
+    'date' => '2016-09-10 19:26:04',
423
+    'behavior' => [
424
+      'id' => 13,
425
+      'name' => 'less time/energy for God, meetings, and church',
426
+      'category_id' => 2,
427
+      'category' => [
428
+        'id' => 2,
429
+        'name' => 'Forgetting Priorities',
430
+      ],
431
+    ],
432
+  ], [
433
+    'id' => 822,
434
+    'user_id' => 2,
435
+    'behavior_id' => 18,
436
+    'date' => '2016-09-10 19:26:04',
437
+    'behavior' => [
438
+      'id' => 18,
439
+      'name' => 'changes in goals',
440
+      'category_id' => 2,
441
+      'category' => [
442
+        'id' => 2,
443
+        'name' => 'Forgetting Priorities',
444
+      ],
445
+    ],
446
+  ], [
447
+    'id' => 823,
448
+    'user_id' => 2,
449
+    'behavior_id' => 29,
450
+    'date' => '2016-09-10 19:26:04',
451
+    'behavior' => [
452
+      'id' => 29,
453
+      'name' => 'using profanity',
454
+      'category_id' => 3,
455
+      'category' => [
456
+        'id' => 3,
457
+        'name' => 'Anxiety',
458
+      ],
459
+    ],
460
+  ], [
461
+    'id' => 824,
462
+    'user_id' => 2,
463
+    'behavior_id' => 41,
464
+    'date' => '2016-09-10 19:26:04',
465
+    'behavior' => [
466
+      'id' => 41,
467
+      'name' => 'co-dependent rescuing',
468
+      'category_id' => 3,
469
+      'category' => [
470
+        'id' => 3,
471
+        'name' => 'Anxiety',
472
+      ],
473
+    ],
474
+  ], [
475
+    'id' => 825,
476
+    'user_id' => 2,
477
+    'behavior_id' => 48,
478
+    'date' => '2016-09-10 19:26:04',
479
+    'behavior' => [
480
+      'id' => 48,
481
+      'name' => 'workaholic',
482
+      'category_id' => 4,
483
+      'category' => [
484
+        'id' => 4,
485
+        'name' => 'Speeding Up',
486
+      ],
487
+    ],
488
+  ], [
489
+    'id' => 826,
490
+    'user_id' => 2,
491
+    'behavior_id' => 72,
492
+    'date' => '2016-09-10 19:26:04',
493
+    'behavior' => [
494
+      'id' => 72,
495
+      'name' => 'black and white, all or nothing thinking',
496
+      'category_id' => 5,
497
+      'category' => [
498
+        'id' => 5,
499
+        'name' => 'Ticked Off',
500
+      ],
501
+    ],
502
+  ], [
503
+    'id' => 827,
504
+    'user_id' => 2,
505
+    'behavior_id' => 79,
506
+    'date' => '2016-09-10 19:26:04',
507
+    'behavior' => [
508
+      'id' => 79,
509
+      'name' => 'blaming',
510
+      'category_id' => 5,
511
+      'category' => [
512
+        'id' => 5,
513
+        'name' => 'Ticked Off',
514
+      ],
515
+    ],
516
+  ], [
517
+    'id' => 828,
518
+    'user_id' => 2,
519
+    'behavior_id' => 89,
520
+    'date' => '2016-09-10 19:26:04',
521
+    'behavior' => [
522
+      'id' => 89,
523
+      'name' => 'obsessive (stuck) thoughts',
524
+      'category_id' => 5,
525
+      'category' => [
526
+        'id' => 5,
527
+        'name' => 'Ticked Off',
528
+      ],
529
+    ],
530
+  ], [
531
+    'id' => 829,
532
+    'user_id' => 2,
533
+    'behavior_id' => 111,
534
+    'date' => '2016-09-10 19:26:04',
535
+    'behavior' => [
536
+      'id' => 111,
537
+      'name' => 'seeking out old unhealthy people and places',
538
+      'category_id' => 6,
539
+      'category' => [
540
+        'id' => 6,
541
+        'name' => 'Exhausted',
542
+      ],
543
+    ],
544
+  ], [
545
+    'id' => 830,
546
+    'user_id' => 2,
547
+    'behavior_id' => 118,
548
+    'date' => '2016-09-10 19:26:04',
549
+    'behavior' => [
550
+      'id' => 118,
551
+      'name' => 'not returning phone calls',
552
+      'category_id' => 6,
553
+      'category' => [
554
+        'id' => 6,
555
+        'name' => 'Exhausted',
556
+      ],
557
+    ],
558
+  ], [
559
+    'id' => 831,
560
+    'user_id' => 2,
561
+    'behavior_id' => 122,
562
+    'date' => '2016-09-10 19:26:04',
563
+    'behavior' => [
564
+      'id' => 122,
565
+      'name' => 'returning to the place you swore you would never go again',
566
+      'category_id' => 7,
567
+      'category' => [
568
+        'id' => 7,
569
+        'name' => 'Relapse/Moral Failure',
570
+      ],
571
+    ],
572
+  ],
573 573
 ];
574 574
 
575 575
 public $userBehaviors = [
576
-	1 => [
577
-		'category_name' => 'Restoration',
578
-		'behaviors' => [
579
-			[
580
-				'id' => 7,
581
-				'name' => 'making eye contact',
582
-			],
583
-		],
584
-	],
585
-	2 => [
586
-		'category_name' => 'Forgetting Priorities',
587
-		'behaviors' => [
588
-			[
589
-				'id' => 13,
590
-				'name' => 'less time/energy for God, meetings, and church',
591
-			], [
592
-				'id' => 18,
593
-				'name' => 'changes in goals',
594
-			],
595
-		],
576
+  1 => [
577
+    'category_name' => 'Restoration',
578
+    'behaviors' => [
579
+      [
580
+        'id' => 7,
581
+        'name' => 'making eye contact',
582
+      ],
583
+    ],
584
+  ],
585
+  2 => [
586
+    'category_name' => 'Forgetting Priorities',
587
+    'behaviors' => [
588
+      [
589
+        'id' => 13,
590
+        'name' => 'less time/energy for God, meetings, and church',
591
+      ], [
592
+        'id' => 18,
593
+        'name' => 'changes in goals',
594
+      ],
595
+    ],
596 596
   ],
597 597
   3 => [
598
-		'category_name' => 'Anxiety',
599
-		'behaviors' => [
600
-			[
601
-				'id' => 29,
602
-				'name' => 'using profanity',
603
-			], [
604
-				'id' => 41,
605
-				'name' => 'co-dependent rescuing',
606
-			],
607
-		],
608
-	],
609
-	4 => [
610
-		'category_name' => 'Speeding Up',
611
-		'behaviors' => [
612
-			[
613
-				'id' => 48,
614
-				'name' => 'workaholic',
615
-			],
616
-		],
617
-	],
618
-	5 => [
619
-		'category_name' => 'Ticked Off',
620
-		'behaviors' => [
621
-			[
622
-				'id' => 72,
623
-				'name' => 'black and white, all or nothing thinking',
624
-			], [
625
-				'id' => 79,
626
-				'name' => 'blaming',
627
-			], [
628
-				'id' => 89,
629
-				'name' => 'obsessive (stuck) thoughts',
630
-			],
631
-		],
632
-	],
633
-	6 => [
634
-		'category_name' => 'Exhausted',
635
-		'behaviors' => [
636
-			[
637
-				'id' => 111,
638
-				'name' => 'seeking out old unhealthy people and places',
639
-			], [
640
-				'id' => 118,
641
-				'name' => 'not returning phone calls',
642
-			],
643
-		],
644
-	],
645
-	7 => [
646
-		'category_name' => 'Relapse/Moral Failure',
647
-		'behaviors' => [
648
-			[
649
-				'id' => 122,
650
-				'name' => 'returning to the place you swore you would never go again',
651
-			],
652
-		],
653
-	],
598
+    'category_name' => 'Anxiety',
599
+    'behaviors' => [
600
+      [
601
+        'id' => 29,
602
+        'name' => 'using profanity',
603
+      ], [
604
+        'id' => 41,
605
+        'name' => 'co-dependent rescuing',
606
+      ],
607
+    ],
608
+  ],
609
+  4 => [
610
+    'category_name' => 'Speeding Up',
611
+    'behaviors' => [
612
+      [
613
+        'id' => 48,
614
+        'name' => 'workaholic',
615
+      ],
616
+    ],
617
+  ],
618
+  5 => [
619
+    'category_name' => 'Ticked Off',
620
+    'behaviors' => [
621
+      [
622
+        'id' => 72,
623
+        'name' => 'black and white, all or nothing thinking',
624
+      ], [
625
+        'id' => 79,
626
+        'name' => 'blaming',
627
+      ], [
628
+        'id' => 89,
629
+        'name' => 'obsessive (stuck) thoughts',
630
+      ],
631
+    ],
632
+  ],
633
+  6 => [
634
+    'category_name' => 'Exhausted',
635
+    'behaviors' => [
636
+      [
637
+        'id' => 111,
638
+        'name' => 'seeking out old unhealthy people and places',
639
+      ], [
640
+        'id' => 118,
641
+        'name' => 'not returning phone calls',
642
+      ],
643
+    ],
644
+  ],
645
+  7 => [
646
+    'category_name' => 'Relapse/Moral Failure',
647
+    'behaviors' => [
648
+      [
649
+        'id' => 122,
650
+        'name' => 'returning to the place you swore you would never go again',
651
+      ],
652
+    ],
653
+  ],
654 654
 ];
655 655
 
656 656
 public $exportData = [
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
     $this->container = new \yii\di\Container;
726 726
     $this->container->set('common\interfaces\UserInterface', '\site\tests\_support\MockUser');
727 727
     $this->container->set('common\interfaces\UserBehaviorInterface', '\site\tests\_support\MockUserBehavior');
728
-    $this->container->set('common\interfaces\TimeInterface', function () {
728
+    $this->container->set('common\interfaces\TimeInterface', function() {
729 729
       return new \common\components\Time('America/Los_Angeles');
730 730
     });
731 731
 
@@ -769,21 +769,21 @@  discard block
 block discarded – undo
769 769
   }
770 770
 
771 771
   public function testParseQuestionData() {
772
-    $this->specify('parseQuestionData should function correctly', function () {
772
+    $this->specify('parseQuestionData should function correctly', function() {
773 773
       expect('parseQuestionData should return the correct structure with expected data', $this->assertEquals($this->user->parseQuestionData($this->questionData), $this->userQuestions));
774 774
       expect('parseQuestionData should return empty with the empty set', $this->assertEmpty($this->user->parseQuestionData([])));
775 775
     });
776 776
   }
777 777
 
778 778
   public function testParseBehaviorData() {
779
-    $this->specify('parseBehaviorData should function correctly', function () {
779
+    $this->specify('parseBehaviorData should function correctly', function() {
780 780
       expect('parseBehaviorData should return the correct structure with expected data', $this->assertEquals($this->user->parseBehaviorData($this->behaviorData), $this->userBehaviors));
781 781
       expect('parseBehaviorData should return empty with the empty set', $this->assertEmpty($this->user->parseBehaviorData([])));
782 782
     });
783 783
   }
784 784
 
785 785
   public function testIsTokenCurrent() {
786
-    $this->specify('isTokenCurrent should function correctly', function () {
786
+    $this->specify('isTokenCurrent should function correctly', function() {
787 787
       $good_token = \Yii::$app
788 788
                       ->getSecurity()
789 789
                       ->generateRandomString() . '_' . time();
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
   public function testConfirmVerifyEmailToken() {
806 806
     $this->user->verify_email_token = 'hello_world';
807 807
     $this->user->confirmVerifyEmailToken();
808
-    expect('confirmVerifyEmailToken should append User::CONFIRMED_STRING to the end of the verify_email_token property', $this->assertEquals($this->user->verify_email_token, 'hello_world'.$this->user::CONFIRMED_STRING));
808
+    expect('confirmVerifyEmailToken should append User::CONFIRMED_STRING to the end of the verify_email_token property', $this->assertEquals($this->user->verify_email_token, 'hello_world' . $this->user::CONFIRMED_STRING));
809 809
   }
810 810
 
811 811
   public function testIsVerified() {
Please login to merge, or discard this patch.
common/models/Category.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -13,13 +13,13 @@
 block discarded – undo
13 13
 {
14 14
 
15 15
   public static $categories = [
16
-    [ "id" => 1, "name" => "Restoration"],
17
-    [ "id" => 2, "name" => "Forgetting Priorities"],
18
-    [ "id" => 3, "name" => "Anxiety"],
19
-    [ "id" => 4, "name" => "Speeding Up"],
20
-    [ "id" => 5, "name" => "Ticked Off"],
21
-    [ "id" => 6, "name" => "Exhausted"],
22
-    [ "id" => 7, "name" => "Relapse/Moral Failure"],
16
+    ["id" => 1, "name" => "Restoration"],
17
+    ["id" => 2, "name" => "Forgetting Priorities"],
18
+    ["id" => 3, "name" => "Anxiety"],
19
+    ["id" => 4, "name" => "Speeding Up"],
20
+    ["id" => 5, "name" => "Ticked Off"],
21
+    ["id" => 6, "name" => "Exhausted"],
22
+    ["id" => 7, "name" => "Relapse/Moral Failure"],
23 23
   ];
24 24
 
25 25
   public static $colors = [
Please login to merge, or discard this patch.
common/models/UserBehavior.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
       ->groupBy('date, user_id')
85 85
       ->having('user_id = :user_id');
86 86
     $temp_dates = $query->all();
87
-    foreach($temp_dates as $temp_date) {
87
+    foreach ($temp_dates as $temp_date) {
88 88
       $past_checkin_dates[] = $this->time->convertUTCToLocal($temp_date['date']);
89 89
     }
90 90
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 
142 142
     $arr = array_reduce($behaviors, function($acc, $row) {
143 143
       $cat_id = $row['behavior']['category']['id'];
144
-      if(array_key_exists($cat_id, $acc)) {
144
+      if (array_key_exists($cat_id, $acc)) {
145 145
         $acc[$cat_id]['count'] += $row['count'];
146 146
       } else {
147 147
         $acc[$cat_id] = [
@@ -158,10 +158,10 @@  discard block
 block discarded – undo
158 158
   }
159 159
 
160 160
   public static function decorate(Array $uo, $with_category = false) {
161
-    foreach($uo as &$o) {
162
-      if($behavior = \common\models\Behavior::getBehavior('id', $o['behavior_id'])) {
161
+    foreach ($uo as &$o) {
162
+      if ($behavior = \common\models\Behavior::getBehavior('id', $o['behavior_id'])) {
163 163
         $o['behavior'] = $behavior;
164
-        if($with_category) {
164
+        if ($with_category) {
165 165
           $o['behavior']['category'] = \common\models\Category::getCategory('id', $o['behavior']['category_id']);
166 166
         }
167 167
       }
@@ -182,11 +182,11 @@  discard block
 block discarded – undo
182 182
       ->having('user_id = :user_id')
183 183
       ->orderBy('count DESC');
184 184
 
185
-    if($limit instanceof \DateTime) {
185
+    if ($limit instanceof \DateTime) {
186 186
       list($start, $end) = $this->time->getUTCBookends($limit->format('Y-m-d'));
187 187
       $query->params += [':start_date' => $start, ':end_date' => $end];
188 188
       $query->where('user_id=:user_id AND date > :start_date AND date <= :end_date');
189
-    } else if(is_int($limit)) {
189
+    } else if (is_int($limit)) {
190 190
       $query->limit($limit);
191 191
     }
192 192
 
Please login to merge, or discard this patch.