Passed
Pull Request — master (#190)
by Corey
03:07
created
console/migrations/m140609_010314_populate_category_and_options_table.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -152,7 +152,7 @@
 block discarded – undo
152 152
             ["condemnation", 7],
153 153
             ["guilt", 7],
154 154
             ["aloneness", 7]
155
-       ]);
155
+        ]);
156 156
     }
157 157
 
158 158
     public function safeDown()
Please login to merge, or discard this patch.
console/migrations/m160403_060352_delete_incorrect_behaviors.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,6 +15,6 @@
 block discarded – undo
15 15
         $this->batchInsert("{{%option}}", ["name", "category_id"], [
16 16
             ["masturbation", 3]
17 17
             , ["pornography", 3]
18
-       ]);
18
+        ]);
19 19
     }
20 20
 }
Please login to merge, or discard this patch.
site/models/CheckinForm.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         }
111 111
 
112 112
         $self = $this;
113
-        array_walk($clean_behaviors, function ($bhvr) use (&$self) {
113
+        array_walk($clean_behaviors, function($bhvr) use (&$self) {
114 114
             if (preg_match('/.*-custom/', $bhvr)) {
115 115
                 $self->custom_behaviors[] = $bhvr;
116 116
             } else {
@@ -141,8 +141,8 @@  discard block
 block discarded – undo
141 141
         );
142 142
 
143 143
         // delete cached behaviors
144
-        array_map(function ($period) use ($time) {
145
-            $key = "checkins_".Yii::$app->user->id."_{$period}_".$time->getLocalDate();
144
+        array_map(function($period) use ($time) {
145
+            $key = "checkins_" . Yii::$app->user->id . "_{$period}_" . $time->getLocalDate();
146 146
             Yii::$app->cache->delete($key);
147 147
         }, [30, 90, 180]);
148 148
     }
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
     public function mergeWithDefault(array $user_behaviors)
157 157
     {
158 158
         $behaviors = AH::index(Yii::$container->get(BehaviorInterface::class)::$behaviors, 'name', "category_id");
159
-        array_walk($behaviors, function (&$bhvrs, $cat_id) use ($user_behaviors) {
159
+        array_walk($behaviors, function(&$bhvrs, $cat_id) use ($user_behaviors) {
160 160
             if (array_key_exists($cat_id, $user_behaviors)) {
161 161
                 $bhvrs = AH::merge($bhvrs, $user_behaviors[$cat_id]);
162 162
             }
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
      */
176 176
     public function getCustomBehaviors()
177 177
     {
178
-        return array_map(function ($cs) {
178
+        return array_map(function($cs) {
179 179
             return (int)explode('-', $cs)[0];
180 180
         }, $this->custom_behaviors);
181 181
     }
Please login to merge, or discard this patch.
site/models/EditProfileForm.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
     }
65 65
 
66 66
     /**
67
-       * @codeCoverageIgnore
68
-       */
67
+     * @codeCoverageIgnore
68
+     */
69 69
     public function attributeLabels()
70 70
     {
71 71
         return [
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 
100 100
                 // generate behaviors graph image
101 101
                 $checkins_last_month = (Yii::$container->get(\common\interfaces\UserBehaviorInterface::class))
102
-                                               ->getCheckInBreakdown();
102
+                                                ->getCheckInBreakdown();
103 103
 
104 104
                 // if they haven't done a check-in in the last month this will explode
105 105
                 // because $checkins_last_month is an empty array
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@
 block discarded – undo
53 53
       ['email_category', 'in', 'range'=>array_keys($this->categories)],
54 54
       [['partner_email1', 'partner_email2', 'partner_email3'], 'email'],
55 55
       [['partner_email1', 'email_category'], 'required',
56
-        'when' => function ($model) {
56
+        'when' => function($model) {
57 57
             return $model->send_email;
58 58
         },
59 59
         'message' => "If you've elected to send email reports, at least one partner email must be set.",
Please login to merge, or discard this patch.
site/models/SignupForm.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
       [
60 60
         ['partner_email1', 'email_category'],
61 61
         'required',
62
-        'when' => function ($model) {
62
+        'when' => function($model) {
63 63
             return $model->send_email;
64 64
         },
65 65
         'message' => "If you've elected to send email reports, at least one partner email must be set.",
Please login to merge, or discard this patch.
site/models/QuestionForm.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -163,12 +163,12 @@
 block discarded – undo
163 163
             foreach ($this->behaviorToAnswers($behavior_id) as $answer_letter => $answer) {
164 164
                 $question_id = \common\models\Question::$TYPES[$answer_letter];
165 165
                 array_push($answers, [
166
-                               'behavior_id'    => $user_bhvr->behavior_id,
167
-                               'category_id'    => $user_bhvr->category_id,
168
-                               'user_bhvr_id' => $user_bhvr->id,
169
-                               'question_id'  => $question_id,
170
-                               'answer'       => $answer,
171
-                             ]);
166
+                                'behavior_id'    => $user_bhvr->behavior_id,
167
+                                'category_id'    => $user_bhvr->category_id,
168
+                                'user_bhvr_id' => $user_bhvr->id,
169
+                                'question_id'  => $question_id,
170
+                                'answer'       => $answer,
171
+                              ]);
172 172
             }
173 173
         }
174 174
         return $answers;
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
         $config = []
56 56
     )
57 57
     {
58
-        $this->question    = $question;
58
+        $this->question = $question;
59 59
         parent::__construct($config);
60 60
     }
61 61
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
         'whenClient' => "function(attribute, value) { return false; }", // lame, but acceptable
74 74
         "message" => "You must select a behavior your responses apply to."],
75 75
 
76
-      [['answer_1a','answer_1b','answer_1c','answer_2a','answer_2b','answer_2c','answer_3a','answer_3b','answer_3c','answer_4a','answer_4b','answer_4c','answer_5a', 'answer_5b','answer_5c','answer_6a', 'answer_6b','answer_6c','answer_7a','answer_7b','answer_7c'], 'safe']
76
+      [['answer_1a', 'answer_1b', 'answer_1c', 'answer_2a', 'answer_2b', 'answer_2c', 'answer_3a', 'answer_3b', 'answer_3c', 'answer_4a', 'answer_4b', 'answer_4c', 'answer_5a', 'answer_5b', 'answer_5c', 'answer_6a', 'answer_6b', 'answer_6c', 'answer_7a', 'answer_7b', 'answer_7c'], 'safe']
77 77
     ];
78 78
     }
79 79
 
@@ -92,8 +92,8 @@  discard block
 block discarded – undo
92 92
 
93 93
     public function getBhvrValidator()
94 94
     {
95
-        return function ($model, $attr) {
96
-            $attrNum = $attr[strlen($attr)-1];
95
+        return function($model, $attr) {
96
+            $attrNum = $attr[strlen($attr) - 1];
97 97
             foreach (['a', 'b', 'c'] as $l) {
98 98
                 $attr = "answer_{$attrNum}{$l}";
99 99
                 if ($model->$attr) {
@@ -124,10 +124,10 @@  discard block
 block discarded – undo
124 124
     public function behaviorToAnswers($bhvr_number)
125 125
     {
126 126
         $prop_names   = array_keys($this->getPrefixProps("answer_$bhvr_number"));
127
-        $prop_letters = array_map(function ($n) {
127
+        $prop_letters = array_map(function($n) {
128 128
             return substr($n, -1, 1);
129 129
         }, $prop_names);
130
-        $answers = array_map(function ($n) {
130
+        $answers = array_map(function($n) {
131 131
             return $this->$n;
132 132
         }, $prop_names);
133 133
  
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 
137 137
     public function getPrefixProps($prefix)
138 138
     {
139
-        return array_filter(get_object_vars($this), function ($v, $k) use ($prefix) {
139
+        return array_filter(get_object_vars($this), function($v, $k) use ($prefix) {
140 140
             if (strpos($k, $prefix) === 0 && strlen($v)) {
141 141
                 return true;
142 142
             }
Please login to merge, or discard this patch.
site/models/ContactForm.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
       ['email', 'filter', 'filter' => 'strtolower'],
30 30
       ['email', 'email'],
31 31
       // verifyCode needs to be entered correctly
32
-      ['verifyCode', 'captcha', 'when' => function () {
32
+      ['verifyCode', 'captcha', 'when' => function() {
33 33
           return Yii::$app->user->isGuest;
34 34
       }, 'skipOnEmpty' => !!YII_ENV_TEST],
35 35
     ];
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         return Yii::$app->mailer->compose()
58 58
       ->setTo($email)
59 59
       ->setFrom([$this->email => $this->name])
60
-      ->setSubject("[FSA Contact] ".$this->subject)
60
+      ->setSubject("[FSA Contact] " . $this->subject)
61 61
       ->setTextBody($this->body)
62 62
       ->send();
63 63
     }
Please login to merge, or discard this patch.
site/tests/unit/models/QuestionFormTest.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -101,10 +101,10 @@
 block discarded – undo
101 101
             $model->answer_2c = 'answering question c';
102 102
 
103 103
             expect('behaviorToAnswers should return the answer properties related to the behavior number supplied', $this->assertEquals($model->behaviorToAnswers(1), [
104
-                                                               'a' => 'answering question a',
105
-                                                               'b' => 'answering question b',
106
-                                                               'c' => 'answering question c'
107
-                                                             ]));
104
+                                                                'a' => 'answering question a',
105
+                                                                'b' => 'answering question b',
106
+                                                                'c' => 'answering question c'
107
+                                                              ]));
108 108
 
109 109
             expect('behaviorToAnswers should return the the empty set when there are no answers associated with the supplied behavior number', $this->assertEmpty($model->behaviorToAnswers(7)));
110 110
         });
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -18,14 +18,14 @@  discard block
 block discarded – undo
18 18
         $this->container->set('common\interfaces\UserInterface', '\site\tests\_support\MockUser');
19 19
         $this->container->set('common\interfaces\UserBehaviorInterface', '\site\tests\_support\MockUserBehavior');
20 20
         $this->container->set('common\interfaces\QuestionInterface', '\site\tests\_support\MockQuestion');
21
-        $this->container->set('common\interfaces\TimeInterface', function () {
21
+        $this->container->set('common\interfaces\TimeInterface', function() {
22 22
             return new \common\components\Time('America/Los_Angeles');
23 23
         });
24 24
     }
25 25
 
26 26
     public function testAttributeLabels()
27 27
     {
28
-        $this->specify('setBehaviors should function properly', function () {
28
+        $this->specify('setBehaviors should function properly', function() {
29 29
             $model = $this->container->get('\site\models\QuestionForm');
30 30
             expect('attributeLabels should be correct', $this->assertEquals($model->attributeLabels(), [
31 31
         'user_behavior_id1' => 'Restoration',
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
         $model = $this->container->get('\site\models\QuestionForm');
45 45
         $validator = $model->getBhvrValidator();
46 46
 
47
-        $this->specify('getBhvrValidator should function properly', function () use ($model, $validator) {
47
+        $this->specify('getBhvrValidator should function properly', function() use ($model, $validator) {
48 48
             expect('getBhvrValidator should return false when nothing is set on the form', $this->assertFalse($validator($model, "user_behavior_id1")));
49 49
             expect('getBhvrValidator should return false when nothing is set on the form', $this->assertFalse($validator($model, "user_behavior_id7")));
50 50
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     {
66 66
         $model = $this->container->get('\site\models\QuestionForm');
67 67
 
68
-        $this->specify('getPrefixProps should function properly', function () use ($model) {
68
+        $this->specify('getPrefixProps should function properly', function() use ($model) {
69 69
             expect('getPrefixProps should strip out all the falsy propeties it finds', $this->assertEmpty($model->getPrefixProps('answer')));
70 70
 
71 71
             $model->answer_1a = 'processing emotions';
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 
91 91
     public function testBehaviorToAnswers()
92 92
     {
93
-        $this->specify('behaviorToAnswers should function properly', function () {
93
+        $this->specify('behaviorToAnswers should function properly', function() {
94 94
             $model = $this->container->get('\site\models\QuestionForm');
95 95
             $model->answer_1a = 'answering question a';
96 96
             $model->answer_1b = 'answering question b';
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
     {
115 115
         $model = $this->container->get('\site\models\QuestionForm');
116 116
 
117
-        $this->specify('getAnswers should function properly', function () use ($model) {
117
+        $this->specify('getAnswers should function properly', function() use ($model) {
118 118
             $model->user_behavior_id1 = 'dummy';
119 119
             $model->user_behavior_id2 = 'dummy';
120 120
             $model->user_behavior_id3 = 'dummy';
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
         $this->fakeModel(7, 280, 8),
133 133
         $this->fakeModel(13, 281, 8),
134 134
         $this->fakeModel(28, 284, 8)
135
-      ]), [ [
135
+      ]), [[
136 136
                                         'behavior_id' => 280,
137 137
                     'category_id' => 8,
138 138
                                         'user_bhvr_id' => 7,
Please login to merge, or discard this patch.
site/tests/unit/models/ChangeEmailFormTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
     public function testChangeEmail()
26 26
     {
27
-        $this->specify('changeEmail() should return true and do nothing when the email is already taken', function () {
27
+        $this->specify('changeEmail() should return true and do nothing when the email is already taken', function() {
28 28
             $user = $this->getUser();
29 29
             $user
30 30
         ->expects($this->never())
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
             $this->assertNotEquals($user->desired_email, $desired_email);
42 42
         });
43 43
 
44
-        $this->specify('changeEmail() should return true, set values, and send an email when the email is available', function () {
44
+        $this->specify('changeEmail() should return true, set values, and send an email when the email is available', function() {
45 45
             $user = $this->getUser();
46 46
             $desired_email = '[email protected]';
47 47
             $user
Please login to merge, or discard this patch.