Passed
Branch master (0efc20)
by Corey
05:14
created
site/controllers/CheckinController.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
     if ($form->load(Yii::$app->request->post()) && $form->validate()) {
40 40
       $form->compiled_behaviors = $form->compileBehaviors();
41 41
 
42
-      if(sizeof($form->compiled_behaviors) === 0) {
42
+      if (sizeof($form->compiled_behaviors) === 0) {
43 43
         return $this->redirect(['view']);
44 44
       }
45 45
 
@@ -49,14 +49,14 @@  discard block
 block discarded – undo
49 49
 
50 50
       // delete cached scores
51 51
       $time = Yii::$container->get('common\interfaces\TimeInterface');
52
-      $key = "scores_of_last_month_".Yii::$app->user->id."_".$time->getLocalDate();
52
+      $key = "scores_of_last_month_" . Yii::$app->user->id . "_" . $time->getLocalDate();
53 53
       Yii::$app->cache->delete($key);
54 54
 
55 55
       // if the user has publicised their score graph, create the image
56
-      if(Yii::$app->user->identity->expose_graph) {
56
+      if (Yii::$app->user->identity->expose_graph) {
57 57
         $user_behavior = Yii::$container->get('common\interfaces\UserBehaviorInterface');
58 58
         $scores_last_month = $user_behavior->calculateScoresOfLastMonth();
59
-        if($scores_last_month) {
59
+        if ($scores_last_month) {
60 60
           Yii::$container
61 61
             ->get('common\components\Graph', [Yii::$app->user->identity])
62 62
             ->create($scores_last_month, true);
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
       return $this->redirect(['questions']);
67 67
     } else {
68 68
       $category = Yii::$container->get('common\interfaces\CategoryInterface');
69
-      $behavior   = Yii::$container->get('common\interfaces\BehaviorInterface');
69
+      $behavior = Yii::$container->get('common\interfaces\BehaviorInterface');
70 70
       return $this->render('index', [
71 71
         'categories'  => $category::$categories,
72 72
         'model'       => $form,
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
       ->get('common\interfaces\TimeInterface')
83 83
       ->getLocalDate();
84 84
     $user_behaviors = $user_behavior->getUserBehaviorsWithCategory($date);
85
-    if(count($user_behaviors) === 0) {
85
+    if (count($user_behaviors) === 0) {
86 86
       return $this->redirect(['view']);
87 87
     }
88 88
 
@@ -92,10 +92,10 @@  discard block
 block discarded – undo
92 92
       $form->deleteToday();
93 93
 
94 94
       $behaviors = $user_behavior->findAll($form->getUserBehaviorIds());
95
-      if($result = $form->saveAnswers($behaviors)) {
95
+      if ($result = $form->saveAnswers($behaviors)) {
96 96
 
97 97
         $score = $user_behavior->getDailyScore();
98
-        if(Yii::$app->user->identity->isOverThreshold($score)) {
98
+        if (Yii::$app->user->identity->isOverThreshold($score)) {
99 99
           Yii::$app->user->identity->sendEmailReport($date);
100 100
           Yii::$app->session->setFlash('warning', 'Your check-in is complete. A notification has been sent to your report partners because of your high score. Reach out to them!');
101 101
         } else {
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
   public function actionView($date = null)
117 117
   {
118 118
     $time = Yii::$container->get('common\interfaces\TimeInterface');
119
-    if(is_null($date)) {
119
+    if (is_null($date)) {
120 120
       $date = $time->getLocalDate();
121 121
     }
122 122
 
Please login to merge, or discard this patch.
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.