Completed
Pull Request — master (#163)
by Corey
04:29 queued 02:02
created
site/web/router.php 3 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -7,12 +7,12 @@
 block discarded – undo
7 7
 set_include_path(get_include_path().':'.__DIR__);
8 8
 if(file_exists($root.$path))
9 9
 {
10
-	if(is_dir($root.$path) && substr($path,strlen($path) - 1, 1) !== '/')
11
-		$path = rtrim($path,'/').'/index.php';
12
-	if(strpos($path,'.php') === false) return false;
13
-	else {
14
-		chdir(dirname($root.$path));
15
-		require_once $root.$path;
16
-	}
10
+  if(is_dir($root.$path) && substr($path,strlen($path) - 1, 1) !== '/')
11
+    $path = rtrim($path,'/').'/index.php';
12
+  if(strpos($path,'.php') === false) return false;
13
+  else {
14
+    chdir(dirname($root.$path));
15
+    require_once $root.$path;
16
+  }
17 17
 }else include_once 'index.php';
18 18
 ?>
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -3,16 +3,16 @@
 block discarded – undo
3 3
 header("Access-Control-Allow-Origin: *");
4 4
 $root = $_SERVER['DOCUMENT_ROOT'];
5 5
 chdir($root);
6
-$path = '/'.ltrim(parse_url($_SERVER['REQUEST_URI'])['path'],'/');
7
-set_include_path(get_include_path().':'.__DIR__);
8
-if(file_exists($root.$path))
6
+$path = '/' . ltrim(parse_url($_SERVER['REQUEST_URI'])['path'], '/');
7
+set_include_path(get_include_path() . ':' . __DIR__);
8
+if (file_exists($root . $path))
9 9
 {
10
-	if(is_dir($root.$path) && substr($path,strlen($path) - 1, 1) !== '/')
11
-		$path = rtrim($path,'/').'/index.php';
12
-	if(strpos($path,'.php') === false) return false;
10
+	if (is_dir($root . $path) && substr($path, strlen($path) - 1, 1) !== '/')
11
+		$path = rtrim($path, '/') . '/index.php';
12
+	if (strpos($path, '.php') === false) return false;
13 13
 	else {
14
-		chdir(dirname($root.$path));
15
-		require_once $root.$path;
14
+		chdir(dirname($root . $path));
15
+		require_once $root . $path;
16 16
 	}
17
-}else include_once 'index.php';
17
+} else include_once 'index.php';
18 18
 ?>
Please login to merge, or discard this patch.
Braces   +9 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,12 +7,16 @@
 block discarded – undo
7 7
 set_include_path(get_include_path().':'.__DIR__);
8 8
 if(file_exists($root.$path))
9 9
 {
10
-	if(is_dir($root.$path) && substr($path,strlen($path) - 1, 1) !== '/')
11
-		$path = rtrim($path,'/').'/index.php';
12
-	if(strpos($path,'.php') === false) return false;
13
-	else {
10
+	if(is_dir($root.$path) && substr($path,strlen($path) - 1, 1) !== '/') {
11
+			$path = rtrim($path,'/').'/index.php';
12
+	}
13
+	if(strpos($path,'.php') === false) {
14
+	  return false;
15
+	} else {
14 16
 		chdir(dirname($root.$path));
15 17
 		require_once $root.$path;
16 18
 	}
17
-}else include_once 'index.php';
19
+} else {
20
+  include_once 'index.php';
21
+}
18 22
 ?>
Please login to merge, or discard this patch.
site/tests/_support/UnitTester.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
 {
21 21
     use _generated\UnitTesterActions;
22 22
 
23
-   /**
24
-    * Define custom actions here
25
-    */
23
+    /**
24
+     * Define custom actions here
25
+     */
26 26
 }
Please login to merge, or discard this patch.
site/views/checkin/report.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -35,12 +35,12 @@
 block discarded – undo
35 35
                 <th>Behavior</th>
36 36
                 <th>Category</th>
37 37
             </tr>
38
-<?php foreach($top_behaviors as $key => $row) {
38
+<?php foreach ($top_behaviors as $key => $row) {
39 39
 $num = $key + 1;
40
-print "<tr>".
41
-  "<td>{$row['count']}</td>".
42
-  "<td>{$row['behavior']['name']}</td>".
43
-  "<td>{$row['behavior']['category']['name']}</td>".
40
+print "<tr>" .
41
+  "<td>{$row['count']}</td>" .
42
+  "<td>{$row['behavior']['name']}</td>" .
43
+  "<td>{$row['behavior']['category']['name']}</td>" .
44 44
   "</tr>";
45 45
 }
46 46
 ?>
Please login to merge, or discard this patch.
common/tests/unit/components/TimeTest.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
       $this->container->set('common\interfaces\UserBehaviorInterface', '\site\tests\_support\MockUserBehavior');
25 25
       $this->container->set('common\interfaces\QuestionInterface', '\site\tests\_support\MockQuestion');
26 26
 
27
-      $this->container->set('common\interfaces\TimeInterface', function () {
27
+      $this->container->set('common\interfaces\TimeInterface', function() {
28 28
         return new \common\components\Time('America/Los_Angeles');
29 29
       });
30 30
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
     public function testGetLocalTime()
42 42
     {
43
-      $this->specify('getLocalTime should function correctly', function () {
43
+      $this->specify('getLocalTime should function correctly', function() {
44 44
         expect("getLocalTime should work with user's set time", $this->assertEquals($this->time->getLocalTime(), (new DateTime("now", new DateTimeZone("America/Los_Angeles")))->format("Y-m-d H:i:s")));
45 45
         expect('getLocalTime should work with a custom timezone', $this->assertEquals($this->time->getLocalTime("UTC"), (new DateTime("now"))->format("Y-m-d H:i:s")));
46 46
       });
@@ -48,13 +48,13 @@  discard block
 block discarded – undo
48 48
 
49 49
     public function testConvertLocalToUTC()
50 50
     {
51
-      $this->specify('convertLocalToUTC should function correctly', function () {
51
+      $this->specify('convertLocalToUTC should function correctly', function() {
52 52
         $la_tz = (new DateTime("now", new DateTimeZone("America/Los_Angeles")))->format("Y-m-d H:i:s");
53 53
 
54 54
         expect('convertLocalToUTC should convert a Los Angeles tz to UTC with the included time', $this->assertEquals($this->time->convertLocalToUTC($la_tz), (new DateTime("now"))->format("Y-m-d H:i:s")));
55 55
         expect('convertLocalToUTC should convert a Los Angeles tz to UTC without the included time', $this->assertEquals($this->time->convertLocalToUTC($la_tz, false), (new DateTime("now"))->format("Y-m-d")));
56 56
         // with UTC
57
-        $this->container->set('common\interfaces\TimeInterface', function () {
57
+        $this->container->set('common\interfaces\TimeInterface', function() {
58 58
           return new \common\components\Time('UTC');
59 59
         });
60 60
         $time = $this->container->get('common\interfaces\TimeInterface');
@@ -67,14 +67,14 @@  discard block
 block discarded – undo
67 67
 
68 68
     public function testConvertUTCToLocal()
69 69
     {
70
-      $this->specify('convertUTCToLocal should function correctly', function () {
70
+      $this->specify('convertUTCToLocal should function correctly', function() {
71 71
         $utc_tz = (new DateTime("now"))->format("Y-m-d H:i:s");
72 72
 
73 73
         expect('convertUTCToLocal should convert a UTC tz to Los Angeles with the included timezone', $this->assertEquals((new DateTime("now", new DateTimeZone("America/Los_Angeles")))->format(DateTime::ATOM), $this->time->convertUTCToLocal($utc_tz)));
74 74
         expect('convertUTCToLocal should convert a UTC tz to Los Angeles without the included timezone', $this->assertEquals($this->time->convertUTCToLocal($utc_tz, false), (new DateTime("now", new DateTimeZone("America/Los_Angeles")))->format("Y-m-d H:i:s")));
75 75
 
76 76
         // with UTC
77
-        $this->container->set('common\interfaces\TimeInterface', function () {
77
+        $this->container->set('common\interfaces\TimeInterface', function() {
78 78
           return new \common\components\Time('UTC');
79 79
         });
80 80
         $time = $this->container->get('common\interfaces\TimeInterface');
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 
88 88
     public function testGetLocalDate()
89 89
     {
90
-      $this->specify('getLocalDate should function correctly', function () {
90
+      $this->specify('getLocalDate should function correctly', function() {
91 91
         expect("getLocalDate should correctly get the user's local date", $this->assertEquals($this->time->getLocalDate(), (new DateTime("now", new DateTimeZone("America/Los_Angeles")))->format("Y-m-d")));
92 92
         expect("getLocalDate should correctly get the local date of a specified timezone", $this->assertEquals($this->time->getLocalDate("UTC"), (new DateTime("now", new DateTimeZone("UTC")))->format("Y-m-d")));
93 93
       });
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
         expect('getUTCBookends should return false if there is a space at the end of the time string', $this->assertFalse($this->time->getUTCBookends('2016-05-30 00:00:00 ')));
110 110
         expect('getUTCBookends should return UTC bookend times from the Los_Angeles tz', $this->assertEquals($this->time->getUTCBookends('2016-05-30'), ['2016-05-30 07:00:00', '2016-05-31 06:59:59']));
111 111
         // with UTC
112
-        $this->container->set('common\interfaces\TimeInterface', function () {
112
+        $this->container->set('common\interfaces\TimeInterface', function() {
113 113
           return new \common\components\Time('UTC');
114 114
         });
115 115
         $time = $this->container->get('common\interfaces\TimeInterface');
Please login to merge, or discard this patch.
common/config/main.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,8 +10,8 @@
 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);
Please login to merge, or discard this patch.
site/views/site/signup.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 				'id' => 'form-signup',
26 26
 				'enableClientValidation' => true,
27 27
         'enableAjaxValidation' => false,
28
-        'options' => [ 'validateOnSubmit' => true ]
28
+        'options' => ['validateOnSubmit' => true]
29 29
 			]); ?>
30 30
         <?= $form->field($model, 'email', ['inputTemplate' => '<div class="input-group"><span class="input-group-addon">@</span>{input}</div>'])->input('email') ?>
31 31
         <?= $form->field($model, 'password', ['inputTemplate' => '<div class="input-group">{input}<span class="input-group-btn"><button id="password-toggle" class="btn btn-default" type="button">Show</button></span></div>'])->passwordInput() ?>
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
           'template' => '<div class="row"><div class="col-md-5">{image}</div><div class="col-md-6 col-md-offset-1">{input}</div></div>',
35 35
         ]) ?>
36 36
         <?= $form->field($model, 'send_email')->checkbox(['disabled'=>true]) ?>
37
-        <div id='send_email_fields' <?php if(!$model->send_email) { ?>style="display: none;"<?php } ?>>
37
+        <div id='send_email_fields' <?php if (!$model->send_email) { ?>style="display: none;"<?php } ?>>
38 38
           <?= $form->field($model, 'partner_email1')->input('email') ?>
39 39
           <?= $form->field($model, 'partner_email2')->input('email') ?>
40 40
           <?= $form->field($model, 'partner_email3')->input('email') ?>
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,11 +22,11 @@
 block discarded – undo
22 22
     <div class="col-md-6 col-md-offset-3">
23 23
       <h1>Sign up</h1>
24 24
 			<?php $form = ActiveForm::begin([
25
-				'id' => 'form-signup',
26
-				'enableClientValidation' => true,
25
+        'id' => 'form-signup',
26
+        'enableClientValidation' => true,
27 27
         'enableAjaxValidation' => false,
28 28
         'options' => [ 'validateOnSubmit' => true ]
29
-			]); ?>
29
+      ]); ?>
30 30
         <?= $form->field($model, 'email', ['inputTemplate' => '<div class="input-group"><span class="input-group-addon">@</span>{input}</div>'])->input('email') ?>
31 31
         <?= $form->field($model, 'password', ['inputTemplate' => '<div class="input-group">{input}<span class="input-group-btn"><button id="password-toggle" class="btn btn-default" type="button">Show</button></span></div>'])->passwordInput() ?>
32 32
         <?= $form->field($model, 'timezone')->dropDownList(array_combine($timezones, $timezones)); ?>
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
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.
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -105,19 +105,19 @@
 block discarded – undo
105 105
     expect('decorate should add Behavior data and Category data to an array of UserBehaviors',
106 106
       $this->assertEquals(
107 107
         $this->user_behavior->decorateWithCategory($this->singleSimpleBehaviorNoBehavior),
108
-         [['id' => 396,
109
-           'user_id' => 2,
110
-           'behavior_id' => 107,
111
-           'date' => '2016-06-17 04:12:43',
112
-           'behavior' => [
113
-             'id' => 107,
114
-             'name' => 'numb',
115
-             'category_id' => 6,
116
-             'category' => [
117
-               'id' => 6,
118
-               'name' => 'Exhausted',
119
-             ]
120
-           ]]]));
108
+          [['id' => 396,
109
+            'user_id' => 2,
110
+            'behavior_id' => 107,
111
+            'date' => '2016-06-17 04:12:43',
112
+            'behavior' => [
113
+              'id' => 107,
114
+              'name' => 'numb',
115
+              'category_id' => 6,
116
+              'category' => [
117
+                'id' => 6,
118
+                'name' => 'Exhausted',
119
+              ]
120
+            ]]]));
121 121
   }
122 122
 
123 123
   public function testGetBehaviorsByCategory() {
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.