Completed
Pull Request — master (#163)
by Corey
02:42
created
console/migrations/m160403_060352_delete_incorrect_behaviors.php 2 patches
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.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
 
13 13
     public function safeDown()
14 14
     {
15
-        $this->batchInsert("{{%option}}", ["name", "category_id"],[
15
+        $this->batchInsert("{{%option}}", ["name", "category_id"], [
16 16
             ["masturbation", 3]
17 17
             , ["pornography", 3]
18 18
        ]);
Please login to merge, or discard this patch.
console/migrations/m150407_034100_fix_typo_in_option.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,6 +12,6 @@
 block discarded – undo
12 12
 
13 13
     public function down()
14 14
     {
15
-		echo "Why even revert this.";
15
+    echo "Why even revert this.";
16 16
     }
17 17
 }
Please login to merge, or discard this patch.
console/migrations/m140609_010314_populate_category_and_options_table.php 2 patches
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -120,39 +120,39 @@
 block discarded – undo
120 120
             ["sleeping too much or too little", 6],
121 121
             ["can't cope", 6],
122 122
             ["overwhelmed", 6],
123
-			['crying for "no reason"', 6],
124
-			["can't think", 6],
125
-			["forgetful", 6],
126
-			["pessimistic", 6],
127
-			["helpless", 6],
128
-			["tired", 6],
129
-			["numb", 6],
130
-			["wanting to run", 6],
131
-			["constant cravings for old coping behaviors", 6],
132
-			["thinking of using drugs and alcohol", 6],
133
-			["seeking out old unhealthy people and places", 6],
134
-			["really isolated", 6],
135
-			["people are angry with you", 6],
136
-			["self-abuse", 6],
137
-			["suicidal thoughts", 6],
138
-			["no goals", 6],
139
-			["survival mode", 6],
140
-			["not returning phone calls", 6],
141
-			["missing work", 6],
142
-			["irritability", 6],
143
-			["loss of appetite", 6],
144
-			["returning to the place you swore you would never go again", 7],
145
-			["giving up", 7],
146
-			["giving in", 7],
147
-			["out of control", 7],
148
-			["lost in your addiction", 7],
149
-			["lying to yourself and others", 7],
150
-			["feeling you just can't manage without your coping behavior, at least for now", 7],
151
-			["shame", 7],
152
-			["condemnation", 7],
153
-			["guilt", 7],
154
-			["aloneness", 7]
155
-       ]);
123
+      ['crying for "no reason"', 6],
124
+      ["can't think", 6],
125
+      ["forgetful", 6],
126
+      ["pessimistic", 6],
127
+      ["helpless", 6],
128
+      ["tired", 6],
129
+      ["numb", 6],
130
+      ["wanting to run", 6],
131
+      ["constant cravings for old coping behaviors", 6],
132
+      ["thinking of using drugs and alcohol", 6],
133
+      ["seeking out old unhealthy people and places", 6],
134
+      ["really isolated", 6],
135
+      ["people are angry with you", 6],
136
+      ["self-abuse", 6],
137
+      ["suicidal thoughts", 6],
138
+      ["no goals", 6],
139
+      ["survival mode", 6],
140
+      ["not returning phone calls", 6],
141
+      ["missing work", 6],
142
+      ["irritability", 6],
143
+      ["loss of appetite", 6],
144
+      ["returning to the place you swore you would never go again", 7],
145
+      ["giving up", 7],
146
+      ["giving in", 7],
147
+      ["out of control", 7],
148
+      ["lost in your addiction", 7],
149
+      ["lying to yourself and others", 7],
150
+      ["feeling you just can't manage without your coping behavior, at least for now", 7],
151
+      ["shame", 7],
152
+      ["condemnation", 7],
153
+      ["guilt", 7],
154
+      ["aloneness", 7]
155
+        ]);
156 156
     }
157 157
 
158 158
     public function safeDown()
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
          */
20 20
 
21 21
 
22
-        $this->batchInsert("{{%option}}", ["name", "category_id"],[
22
+        $this->batchInsert("{{%option}}", ["name", "category_id"], [
23 23
             ["no current secrets", 1],
24 24
             ["resolving problems", 1],
25 25
             ["identifying fears and feelings", 1],
Please login to merge, or discard this patch.
common/components/Time.php 2 patches
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -31,16 +31,18 @@
 block discarded – undo
31 31
   }
32 32
 
33 33
   public function getLocalTime($timezone = null) {
34
-    if($timezone === null)
35
-      $timezone = $this->timezone;
34
+    if($timezone === null) {
35
+          $timezone = $this->timezone;
36
+    }
36 37
 
37 38
     $timestamp = new DateTime("now", new DateTimeZone($timezone));
38 39
     return $timestamp->format("Y-m-d H:i:s");
39 40
   }
40 41
 
41 42
   public function getLocalDate($timezone = null) {
42
-    if($timezone === null)
43
-      $timezone = $this->timezone;
43
+    if($timezone === null) {
44
+          $timezone = $this->timezone;
45
+    }
44 46
 
45 47
     return (new DateTime("now", new DateTimeZone($timezone)))
46 48
       ->format("Y-m-d");
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -27,11 +27,11 @@  discard block
 block discarded – undo
27 27
    */
28 28
   public function parse(string $time, string $format = 'Y-m-d') {
29 29
     $dt = DateTime::createFromFormat($format, $time, new DateTimeZone($this->timezone));
30
-    if($dt) {
30
+    if ($dt) {
31 31
       // for some reason, using createFromFromat adds in the time. The regular DateTime constructor _does not_ do this. We manually zero out the time here to make the DateTime objects match.
32 32
       $dt->setTime(0, 0, 0);
33 33
       $formatted = $dt->format($format);
34
-      if($formatted === $time && $this->inBounds($dt)) {
34
+      if ($formatted === $time && $this->inBounds($dt)) {
35 35
         return $dt;
36 36
       }
37 37
     }
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     $test  = strtotime($dt->format('Y-m-d'));
51 51
     $now   = strtotime($this->getLocalDate());
52 52
 
53
-    if($first <= $test && $test <= $now) {
53
+    if ($first <= $test && $test <= $now) {
54 54
       return true;
55 55
     } else {
56 56
       return false;
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
   }
75 75
 
76 76
   public function getLocalTime($timezone = null) {
77
-    if($timezone === null)
77
+    if ($timezone === null)
78 78
       $timezone = $this->timezone;
79 79
 
80 80
     $timestamp = new DateTime("now", new DateTimeZone($timezone));
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
   }
83 83
 
84 84
   public function getLocalDate($timezone = null) {
85
-    if($timezone === null)
85
+    if ($timezone === null)
86 86
       $timezone = $this->timezone;
87 87
 
88 88
     return (new DateTime("now", new DateTimeZone($timezone)))
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 
97 97
   public function getUTCBookends($local) {
98 98
     $local = trim($local);
99
-    if(strpos($local, " ")) {
99
+    if (strpos($local, " ")) {
100 100
       return false;
101 101
     }
102 102
 
Please login to merge, or discard this patch.
common/components/Graph.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
   public function getFilepath() {
26 26
     $path = Yii::getAlias('@graphImgPath');
27 27
     $filename = $this->user->getIdHash() . ".png";
28
-    return $path. '/' . $filename;
28
+    return $path . '/' . $filename;
29 29
   }
30 30
 
31 31
   /**
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
    * @return string the encoded image
59 59
    */
60 60
   public function create(array $values, bool $save = false) {
61
-    if($save) {
61
+    if ($save) {
62 62
       // wipe out the current image, if it exists
63 63
       $this->destroy();
64 64
     }
@@ -95,9 +95,9 @@  discard block
 block discarded – undo
95 95
     imagepng($img);
96 96
     $img_data = ob_get_clean();
97 97
 
98
-    if($save) {
98
+    if ($save) {
99 99
       $filepath = $this->getFilepath(); 
100
-      if(!is_dir(dirname($filepath))) {
100
+      if (!is_dir(dirname($filepath))) {
101 101
         mkdir(dirname($filepath), 0766, true);
102 102
       }
103 103
 
Please login to merge, or discard this patch.
common/components/Utility.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
   public static $REVISION_FILE = "./REVISION";
8 8
 
9 9
   public static function getGithubRevUrl($file = false) {
10
-    if($hash = self::getRevHash($file)) {
10
+    if ($hash = self::getRevHash($file)) {
11 11
       return "https://github.com/CorWatts/fasterscale/commit/$hash";
12 12
     }
13 13
     return false;
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 
16 16
   public static function getRevHash($file = false) {
17 17
     $file = $file ?: self::$REVISION_FILE;
18
-    if(is_file($file) && is_readable($file)) {
18
+    if (is_file($file) && is_readable($file)) {
19 19
       return substr(file_get_contents($file), 0, 7);
20 20
     }
21 21
     return false;
Please login to merge, or discard this patch.
common/tests/unit/components/UtilityTest.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
   protected function tearDown()
23 23
   {
24 24
     // just in case we're forgetful :)
25
-    if(file_exists(Utility::$REVISION_FILE)) $this->_deleteRevFile();
25
+    if (file_exists(Utility::$REVISION_FILE)) $this->_deleteRevFile();
26 26
     parent::tearDown();
27 27
   }
28 28
 
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 
38 38
   public function testGetRevHash()
39 39
   {
40
-    $this->specify('getRevHash should function correctly', function () {
40
+    $this->specify('getRevHash should function correctly', function() {
41 41
       expect('getRevHash should return false when the file does not exist', $this->assertFalse(Utility::getRevHash()));
42 42
 
43 43
       $this->_createRevFile();
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,9 @@
 block discarded – undo
22 22
   protected function tearDown()
23 23
   {
24 24
     // just in case we're forgetful :)
25
-    if(file_exists(Utility::$REVISION_FILE)) $this->_deleteRevFile();
25
+    if(file_exists(Utility::$REVISION_FILE)) {
26
+      $this->_deleteRevFile();
27
+    }
26 28
     parent::tearDown();
27 29
   }
28 30
 
Please login to merge, or discard this patch.
common/tests/unit/components/GraphTest.php 1 patch
Spacing   +5 added lines, -5 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() {
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
       ->method('getFilepath')
65 65
       ->willReturn($this->filepath);
66 66
 
67
-    if(!file_exists($this->filepath) && preg_match('%/_output/test_graph.png$%', $this->filepath)) {
67
+    if (!file_exists($this->filepath) && preg_match('%/_output/test_graph.png$%', $this->filepath)) {
68 68
       touch($this->filepath);
69 69
       expect('just a check to be sure $filepath is sane', $this->assertStringEndsWith('/_output/test_graph.png', $this->filepath));
70 70
       expect('the generated file should exist', $this->assertFileExists($this->filepath));
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
     expect('the generated file should be readable', $this->assertFileExists($this->filepath_extra));
104 104
 
105 105
     // cleanup
106
-    if(file_exists($this->filepath_extra) && preg_match('%/_output/charts/test_graph.png%', $this->filepath_extra)) {
106
+    if (file_exists($this->filepath_extra) && preg_match('%/_output/charts/test_graph.png%', $this->filepath_extra)) {
107 107
       // just in case something is weird, we don't want to straight rm this file
108 108
       unlink($this->filepath_extra);
109 109
       rmdir(dirname($this->filepath_extra));
Please login to merge, or discard this patch.
common/tests/unit/models/LoginFormTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
       ->getMock();
32 32
 
33 33
     $mocks = \yii\helpers\ArrayHelper::merge($defaultMocks, $mocks);
34
-    foreach($mocks as $name => $val) {
34
+    foreach ($mocks as $name => $val) {
35 35
       $user->method($name)->willReturn($val);
36 36
     }
37 37
     $user->method('findByEmail')->will($this->returnSelf());
Please login to merge, or discard this patch.