Completed
Push — master ( 42d56d...da4528 )
by Corey
03:35
created
site/controllers/SiteController.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
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
-    if($posts === false) {
60
+    if ($posts === false) {
61 61
       $posts = \Yii::$app->getModule('blog')
62 62
                             ->fetch()
63 63
                             ->parse()
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
   {
91 91
     $model = new \site\models\ContactForm();
92 92
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
93
-      if($model->sendEmail(Yii::$app->params['adminEmail'])) {
93
+      if ($model->sendEmail(Yii::$app->params['adminEmail'])) {
94 94
         Yii::$app->session->setFlash('success', 'Thank you for contacting us. We will respond to you as soon as possible.');
95 95
       } else {
96 96
         Yii::$app->session->setFlash('error', 'There was an error sending email.');
@@ -122,10 +122,10 @@  discard block
 block discarded – undo
122 122
   public function actionSignup()
123 123
   {
124 124
     $model = Yii::$container->get(\site\models\SignupForm::class);
125
-    if($model->load(Yii::$app->request->post()) && $model->validate()) {
125
+    if ($model->load(Yii::$app->request->post()) && $model->validate()) {
126 126
       $model->signup();
127 127
       Yii::$app->session->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.');
128
-      return $this->redirect('/',302);
128
+      return $this->redirect('/', 302);
129 129
     }
130 130
 
131 131
     return $this->render('signup', [
@@ -136,10 +136,10 @@  discard block
 block discarded – undo
136 136
   public function actionRequestPasswordReset()
137 137
   {
138 138
     $model = Yii::$container->get(\site\models\PasswordResetRequestForm::class);
139
-    if($model->load(Yii::$app->request->post()) && $model->validate()) {
140
-      if(!$model->sendEmail()) {
139
+    if ($model->load(Yii::$app->request->post()) && $model->validate()) {
140
+      if (!$model->sendEmail()) {
141 141
         $ip = Yii::$app->getRequest()->getUserIP() ?: "UNKNOWN";
142
-        Yii::warning("$ip has tried to reset the password for ".$model->email);
142
+        Yii::warning("$ip has tried to reset the password for " . $model->email);
143 143
       }
144 144
 
145 145
       Yii::$app->session->setFlash('success', 'If there is an account with the submitted email address you will receive further instructions in your email inbox.');
@@ -183,14 +183,14 @@  discard block
 block discarded – undo
183 183
       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.");
184 184
     }
185 185
 
186
-    if($user->isTokenConfirmed($user->verify_email_token)) {
186
+    if ($user->isTokenConfirmed($user->verify_email_token)) {
187 187
       Yii::$app->session->setFlash('success', 'Your account has already been verified. Please log in.');
188
-      return $this->redirect('/login',302);
188
+      return $this->redirect('/login', 302);
189 189
     } else if (Yii::$app->getUser()->login($user)) {
190 190
       $user->confirmVerifyEmailToken();
191 191
       $user->save();
192 192
       Yii::$app->session->setFlash('success', 'Your account has been verified. Please continue with your check-in.');
193
-      return $this->redirect('/welcome',302);
193
+      return $this->redirect('/welcome', 302);
194 194
     }
195 195
   }
196 196
 
Please login to merge, or discard this patch.
common/components/View.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
         }
37 37
 
38 38
         if (!empty($this->json)) {
39
-          foreach($this->json[self::POS_READY] as $json_name => $json_value) {
39
+          foreach ($this->json[self::POS_READY] as $json_name => $json_value) {
40 40
             $lines[] = Html::script($json_value, ['type' => 'application/json', 'id' => $json_name]);
41 41
           }
42 42
         }
Please login to merge, or discard this patch.
common/components/Controller.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,8 +33,8 @@
 block discarded – undo
33 33
   {
34 34
     return [
35 35
       'error' => [
36
-         'class' => 'yii\web\ErrorAction',
37
-       ],
36
+          'class' => 'yii\web\ErrorAction',
37
+        ],
38 38
       'captcha' => [
39 39
         'class' => 'yii\captcha\CaptchaAction',
40 40
       ],
Please login to merge, or discard this patch.
common/models/LoginForm.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -60,10 +60,10 @@
 block discarded – undo
60 60
    */
61 61
   public function login()
62 62
   {
63
-    if($this->validate()) {
63
+    if ($this->validate()) {
64 64
       $user = $this->getUser();
65
-      if($user->isVerified()) {
66
-        return Yii::$app->user->login($user, $this->rememberMe ? 3600 * 24 * 30 : 0);
65
+      if ($user->isVerified()) {
66
+        return Yii::$app->user->login($user, $this->rememberMe ? 3600*24*30 : 0);
67 67
       } else {
68 68
         Yii::$app->session->setFlash('warning', 'You must verify your account before you can proceed. Please check your email inbox for a verification email and follow the instructions.');
69 69
       }
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
@@ -12,13 +12,13 @@
 block discarded – undo
12 12
 class Category extends \yii\base\BaseObject implements \common\interfaces\CategoryInterface {
13 13
 
14 14
   public static $categories = [
15
-    [ "id" => 1, "name" => "Restoration"],
16
-    [ "id" => 2, "name" => "Forgetting Priorities"],
17
-    [ "id" => 3, "name" => "Anxiety"],
18
-    [ "id" => 4, "name" => "Speeding Up"],
19
-    [ "id" => 5, "name" => "Ticked Off"],
20
-    [ "id" => 6, "name" => "Exhausted"],
21
-    [ "id" => 7, "name" => "Relapse/Moral Failure"],
15
+    ["id" => 1, "name" => "Restoration"],
16
+    ["id" => 2, "name" => "Forgetting Priorities"],
17
+    ["id" => 3, "name" => "Anxiety"],
18
+    ["id" => 4, "name" => "Speeding Up"],
19
+    ["id" => 5, "name" => "Ticked Off"],
20
+    ["id" => 6, "name" => "Exhausted"],
21
+    ["id" => 7, "name" => "Relapse/Moral Failure"],
22 22
   ];
23 23
 
24 24
   public static $colors = [
Please login to merge, or discard this patch.
common/config/main.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,8 +10,8 @@  discard block
 block discarded – undo
10 10
       'common\interfaces\QuestionInterface' => \common\models\Question::class,
11 11
       'common\interfaces\BehaviorInterface' => \common\models\Behavior::class,
12 12
       'common\interfaces\CategoryInterface' => \common\models\Category::class,
13
-      'common\interfaces\TimeInterface' => function () {
14
-        if(Yii::$app->user->getIsGuest()) {
13
+      'common\interfaces\TimeInterface' => function() {
14
+        if (Yii::$app->user->getIsGuest()) {
15 15
           return new \common\components\Time('UTC');
16 16
         } else {
17 17
           return new \common\components\Time(Yii::$app->user->identity->timezone);
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
   ],
29 29
   'components' => [
30 30
     // by default, sessions are stored in a local file
31
-    'cache' => [ // DummyCache never actually caches anything
31
+    'cache' => [// DummyCache never actually caches anything
32 32
       'class'=> yii\caching\DummyCache::class,
33 33
     ],
34 34
     'mailer' => [
Please login to merge, or discard this patch.
common/tests/unit/components/GraphTest.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -14,8 +14,8 @@  discard block
 block discarded – undo
14 14
   use \Codeception\Specify;
15 15
 
16 16
   private $user;
17
-  private $filepath = __DIR__.'/../../_output/test_graph.png';
18
-  private $filepath_extra = __DIR__.'/../../_output/charts/test_graph.png';
17
+  private $filepath = __DIR__ . '/../../_output/test_graph.png';
18
+  private $filepath_extra = __DIR__ . '/../../_output/charts/test_graph.png';
19 19
 
20 20
   public function setUp() {
21 21
     $this->user = $this->getMockBuilder('\site\tests\_support\MockUser')
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
       ->willReturn('random1DH4sh');
37 37
     $graph = new Graph($this->user);
38 38
 
39
-    expect('the expected graph image filepath will be returned', $this->assertEquals(dirname(dirname(dirname(dirname(__DIR__)))).'/site/web/charts/random1DH4sh.png', $graph->getFilepath()));
39
+    expect('the expected graph image filepath will be returned', $this->assertEquals(dirname(dirname(dirname(dirname(__DIR__)))) . '/site/web/charts/random1DH4sh.png', $graph->getFilepath()));
40 40
   }
41 41
 
42 42
   public function testGetUrl() {
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
       ->method('getFilepath')
58 58
       ->willReturn($this->filepath);
59 59
 
60
-    if(!file_exists($this->filepath) && preg_match('%/_output/test_graph.png$%', $this->filepath)) {
60
+    if (!file_exists($this->filepath) && preg_match('%/_output/test_graph.png$%', $this->filepath)) {
61 61
       touch($this->filepath);
62 62
       expect('just a check to be sure $filepath is sane', $this->assertStringEndsWith('/_output/test_graph.png', $this->filepath));
63 63
       expect('the generated file should exist', $this->assertFileExists($this->filepath));
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     expect('the generated file should be readable', $this->assertFileExists($this->filepath_extra));
90 90
 
91 91
     // cleanup
92
-    if(file_exists($this->filepath_extra) && preg_match('%/_output/charts/test_graph.png%', $this->filepath_extra)) {
92
+    if (file_exists($this->filepath_extra) && preg_match('%/_output/charts/test_graph.png%', $this->filepath_extra)) {
93 93
       // just in case something is weird, we don't want to straight rm this file
94 94
       unlink($this->filepath_extra);
95 95
       rmdir(dirname($this->filepath_extra));
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
   }
98 98
 }
99 99
 
100
-function checkinBreakdown () {
100
+function checkinBreakdown() {
101 101
   return [
102 102
       '2019-01-31' => [],
103 103
       '2019-02-01' => [],
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
       '2019-02-27' => [],
231 231
       '2019-02-28' => [],
232 232
       '2019-03-01' => [
233
-        2 => [ 'name' => 'Forgetting Priorities',
233
+        2 => ['name' => 'Forgetting Priorities',
234 234
         'count' => 6,
235 235
         'color' => '#4CA100',
236 236
         'highlight' => '#61B219',
Please login to merge, or discard this patch.
site/tests/unit/models/EditProfileFormTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,11 +41,11 @@
 block discarded – undo
41 41
 
42 42
     // Set up dependency injections
43 43
     Yii::$container
44
-      ->set(\common\interfaces\TimeInterface::class, function () { return new \common\components\Time('UTC'); });
44
+      ->set(\common\interfaces\TimeInterface::class, function() { return new \common\components\Time('UTC'); });
45 45
     Yii::$container
46
-      ->set(\common\components\Graph::class, function () { return $this->graph; });
46
+      ->set(\common\components\Graph::class, function() { return $this->graph; });
47 47
     Yii::$container
48
-      ->set(\common\interfaces\UserBehaviorInterface::class, function () { return new FakeUserBehavior(); });
48
+      ->set(\common\interfaces\UserBehaviorInterface::class, function() { return new FakeUserBehavior(); });
49 49
 
50 50
     // Actually begin testing
51 51
     $form->attributes = $this->values;
Please login to merge, or discard this patch.
site/views/profile/index.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -70,11 +70,11 @@
 block discarded – undo
70 70
 ]); ?>
71 71
             <?= $form->field($profile, 'timezone')->dropDownList(array_combine($timezones, $timezones)); ?>
72 72
             <?= $form->field($profile, 'expose_graph')->checkbox() ?>
73
-            <?php if($profile->expose_graph): ?>
73
+            <?php if ($profile->expose_graph): ?>
74 74
             <div class='alert alert-success score-graph-info'>Your score graph can be found at:<br /> <a id="score-graph-link" target="_blank" href="<?=$graph_url?>"><?=$graph_url?></a></div>
75 75
             <?php endif; ?>
76 76
             <?= $form->field($profile, 'send_email')->checkbox() ?>
77
-            <div id='send_email_fields' <?php if(!$profile->send_email) { ?>style="display: none;"<?php } ?>>
77
+            <div id='send_email_fields' <?php if (!$profile->send_email) { ?>style="display: none;"<?php } ?>>
78 78
               <?= $form->field($profile, 'partner_email1')->input('email'); ?>
79 79
               <?= $form->field($profile, 'partner_email2')->input('email'); ?>
80 80
               <?= $form->field($profile, 'partner_email3')->input('email'); ?>
Please login to merge, or discard this patch.