Failed Conditions
Pull Request — master (#1328)
by Nick
33:04 queued 18:05
created
classes/EditQueue.php 2 patches
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -185,8 +185,7 @@  discard block
 block discarded – undo
185 185
                             WHERE edit_id=" . $approval_id . ";");
186 186
             if (!$q->success()) {
187 187
                 break;
188
-            }
189
-            else {
188
+            } else {
190 189
                 // Now send them an email telling them they've been approved
191 190
 
192 191
 
@@ -227,8 +226,7 @@  discard block
 block discarded – undo
227 226
                             WHERE edit_id=" . $decline_id . ";");
228 227
             if (!$q->success()) {
229 228
                 break;
230
-            }
231
-            else {
229
+            } else {
232 230
                 // Scrub that one from the list of pending items
233 231
                 unset ($this->pending[$decline_id]);
234 232
             }
@@ -266,8 +264,7 @@  discard block
 block discarded – undo
266 264
             $this->update_pending_count();
267 265
 
268 266
             return true;
269
-        }
270
-        else {
267
+        } else {
271 268
             return false;
272 269
         }
273 270
     }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
             // the new epobject id and approval details.
179 179
             $q = $this->db->query("UPDATE editqueue
180 180
                             SET
181
-                            epobject_id_l='" .  $this->current_epobject_id. "',
181
+                            epobject_id_l='" .  $this->current_epobject_id . "',
182 182
                             editor_id='" . addslashes($THEUSER->user_id()) . "',
183 183
                             approved='1',
184 184
                             decided='" . $timestamp . "'
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
         $q = $this->db->query("SELECT eq.edit_id, eq.user_id, u.firstname, u.lastname, eq.glossary_id, eq.title, eq.body, eq.submitted FROM editqueue AS eq, users AS u WHERE eq.user_id = u.user_id AND eq.approved IS NULL ORDER BY eq.submitted DESC;");
261 261
         if ($q->success() && $q->rows()) {
262 262
             for ($i = 0; $i < ($q->rows()); $i++) {
263
-                $this->pending[ $q->field($i,"edit_id") ] = $q->row($i);
263
+                $this->pending[$q->field($i, "edit_id")] = $q->row($i);
264 264
             }
265 265
 
266 266
             $this->update_pending_count();
Please login to merge, or discard this patch.
classes/GlossaryEditQueue.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -68,8 +68,7 @@
 block discarded – undo
68 68
                             WHERE edit_id=" . $approval_id . ";");
69 69
             if (!$q->success()) {
70 70
                 break;
71
-            }
72
-            else {
71
+            } else {
73 72
                 // Scrub that one from the list of pending items
74 73
                 unset ($this->pending[$approval_id]);
75 74
             }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@
 block discarded – undo
61 61
             // the new epobject id and approval details.
62 62
             $q = $this->db->query("UPDATE editqueue
63 63
                             SET
64
-                            glossary_id='" .  $this->current_epobject_id. "',
64
+                            glossary_id='" .  $this->current_epobject_id . "',
65 65
                             editor_id='" . addslashes($THEUSER->user_id()) . "',
66 66
                             approved='1',
67 67
                             decided='" . $timestamp . "'
Please login to merge, or discard this patch.
classes/Memcache.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -26,9 +26,9 @@  discard block
 block discarded – undo
26 26
 
27 27
     public function set($key, $value, $timeout = 3600) {
28 28
         if (class_exists('\Memcached')) {
29
-            self::$memcache->set(OPTION_TWFY_DB_NAME.':'.$key, $value, $timeout);
29
+            self::$memcache->set(OPTION_TWFY_DB_NAME . ':' . $key, $value, $timeout);
30 30
         } else {
31
-            self::$memcache->set(OPTION_TWFY_DB_NAME.':'.$key, $value, MEMCACHE_COMPRESSED, $timeout);
31
+            self::$memcache->set(OPTION_TWFY_DB_NAME . ':' . $key, $value, MEMCACHE_COMPRESSED, $timeout);
32 32
         }
33 33
     }
34 34
 
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
         // see http://php.net/manual/en/memcache.get.php#112056 for explanation of this
37 37
         $was_found = false;
38 38
         if (class_exists('\Memcached')) {
39
-            $value = self::$memcache->get(OPTION_TWFY_DB_NAME.':'.$key, null, $was_found);
39
+            $value = self::$memcache->get(OPTION_TWFY_DB_NAME . ':' . $key, null, $was_found);
40 40
         } else {
41
-            $value = self::$memcache->get(OPTION_TWFY_DB_NAME.':'.$key, $was_found);
41
+            $value = self::$memcache->get(OPTION_TWFY_DB_NAME . ':' . $key, $was_found);
42 42
         }
43 43
         if ($was_found === false) {
44 44
             return false; // mmmmm
Please login to merge, or discard this patch.
classes/Utility/Alert.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
         }
20 20
 
21 21
         if (!empty($details['pid'])) {
22
-            $criteria[] = 'speaker:'.$details['pid'];
22
+            $criteria[] = 'speaker:' . $details['pid'];
23 23
         }
24 24
 
25 25
         $criteria = join(' ', $criteria);
@@ -33,13 +33,13 @@  discard block
 block discarded – undo
33 33
                 ':email' => $email
34 34
             ));
35 35
         $out = '';
36
-        for ($i=0; $i<$q->rows(); ++$i) {
36
+        for ($i = 0; $i < $q->rows(); ++$i) {
37 37
             $row = $q->row($i);
38
-            $criteria = explode(' ',$row['criteria']);
38
+            $criteria = explode(' ', $row['criteria']);
39 39
             $ccc = array();
40 40
             $current = true;
41 41
             foreach ($criteria as $c) {
42
-                if (preg_match('#^speaker:(\d+)#',$c,$m)) {
42
+                if (preg_match('#^speaker:(\d+)#', $c, $m)) {
43 43
                     $MEMBER = new \MEMBER(array('person_id'=>$m[1]));
44 44
                     $ccc[] = 'spoken by ' . $MEMBER->full_name();
45 45
                     if (!$MEMBER->current_member_anywhere()) {
@@ -49,12 +49,12 @@  discard block
 block discarded – undo
49 49
                     $ccc[] = $c;
50 50
                 }
51 51
             }
52
-            $criteria = join(' ',$ccc);
52
+            $criteria = join(' ', $ccc);
53 53
             $token = $row['alert_id'] . '-' . $row['registrationtoken'];
54
-            $action = '<form action="/alert/" method="post"><input type="hidden" name="t" value="'.$token.'">';
54
+            $action = '<form action="/alert/" method="post"><input type="hidden" name="t" value="' . $token . '">';
55 55
             if (!$row['confirmed']) {
56 56
                 $action .= '<input type="submit" name="action" value="Confirm">';
57
-            } elseif ($row['deleted']==2) {
57
+            } elseif ($row['deleted'] == 2) {
58 58
                 $action .= '<input type="submit" name="action" value="Resume">';
59 59
             } else {
60 60
                 $action .= '<input type="submit" name="action" value="Suspend"> <input type="submit" name="action" value="Delete">';
Please login to merge, or discard this patch.
classes/Utility/Calendar.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@
 block discarded – undo
91 91
         } else {
92 92
             $title = $e['title'];
93 93
             if ($pid = $e['person_id']) {
94
-                $MEMBER = new \MEMBER(array( 'person_id' => $pid ));
94
+                $MEMBER = new \MEMBER(array('person_id' => $pid));
95 95
                 $name = $MEMBER->full_name();
96 96
                 $title .= " &#8211; <a href='/mp/?p=$pid'>$name</a>";
97 97
             }
Please login to merge, or discard this patch.
tests/AcceptApiTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
      */
12 12
     public function getDataSet()
13 13
     {
14
-        return $this->createMySQLXMLDataSet(dirname(__FILE__).'/_fixtures/api.xml');
14
+        return $this->createMySQLXMLDataSet(dirname(__FILE__) . '/_fixtures/api.xml');
15 15
     }
16 16
 
17 17
     private function fetch_page($method, $vars = array())
Please login to merge, or discard this patch.
tests/TopicsTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
      */
12 12
     public function getDataSet()
13 13
     {
14
-        return $this->createMySQLXMLDataSet(dirname(__FILE__).'/_fixtures/topics.xml');
14
+        return $this->createMySQLXMLDataSet(dirname(__FILE__) . '/_fixtures/topics.xml');
15 15
     }
16 16
 
17 17
     private function fetch_topics_page($vars)
Please login to merge, or discard this patch.
tests/AlertsPageTest.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
      */
12 12
     public function getDataSet()
13 13
     {
14
-        return $this->createMySQLXMLDataSet(dirname(__FILE__).'/_fixtures/alertspage.xml');
14
+        return $this->createMySQLXMLDataSet(dirname(__FILE__) . '/_fixtures/alertspage.xml');
15 15
     }
16 16
 
17 17
     private function fetch_page($vars)
@@ -21,37 +21,37 @@  discard block
 block discarded – undo
21 21
 
22 22
     public function testFetchPage()
23 23
     {
24
-        $page = $this->fetch_page( array() );
24
+        $page = $this->fetch_page(array());
25 25
         $this->assertContains('TheyWorkForYou Email Alerts', $page);
26 26
     }
27 27
 
28 28
     public function testKeywordOnly() {
29
-        $page = $this->fetch_page( array( 'alertsearch' => 'elephant') );
29
+        $page = $this->fetch_page(array('alertsearch' => 'elephant'));
30 30
         $this->assertContains('Receive alerts when [elephant] is mentioned', $page);
31 31
     }
32 32
 
33 33
     public function testPostCodeOnly() {
34
-        $page = $this->fetch_page( array( 'alertsearch' => 'SE17 3HE') );
34
+        $page = $this->fetch_page(array('alertsearch' => 'SE17 3HE'));
35 35
         $this->assertContains('when Mrs Test Current-MP', $page);
36 36
     }
37 37
 
38 38
     public function testPostCodeWithKeyWord()
39 39
     {
40
-        $page = $this->fetch_page( array( 'alertsearch' => 'SE17 3HE elephant') );
40
+        $page = $this->fetch_page(array('alertsearch' => 'SE17 3HE elephant'));
41 41
         $this->assertContains('You have used a postcode and something else', $page);
42 42
         $this->assertContains('Mentions of [elephant] by Mrs Test Current-MP', $page);
43 43
         $this->assertNotContains('by your MSP', $page);
44 44
     }
45 45
 
46 46
     public function testScottishPostcodeWithKeyword() {
47
-        $page = $this->fetch_page( array( 'alertsearch' => 'PH6 2DB elephant') );
47
+        $page = $this->fetch_page(array('alertsearch' => 'PH6 2DB elephant'));
48 48
         $this->assertContains('You have used a postcode and something else', $page);
49 49
         $this->assertContains('Mentions of [elephant] by your MP, Mr Test2 Current-MP', $page);
50 50
         $this->assertContains('Mentions of [elephant] by your MSP, Mrs Test Current-MSP', $page);
51 51
     }
52 52
 
53 53
     public function testPostcodeAndKeywordWithNoSittingMP() {
54
-        $page = $this->fetch_page( array( 'alertsearch' => 'OX1 4LF elephant') );
54
+        $page = $this->fetch_page(array('alertsearch' => 'OX1 4LF elephant'));
55 55
         $this->assertContains('You have used a postcode and something else', $page);
56 56
         $this->assertNotContains('Did you mean to get alerts for when your MP', $page);
57 57
     }
Please login to merge, or discard this patch.
tests/DivisionsTest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -17,17 +17,17 @@  discard block
 block discarded – undo
17 17
     }
18 18
 
19 19
     private function fetch_division_page() {
20
-        return $this->fetch_page( array( 'pagetype' => 'divisions', 'pid' => 2, 'policy' => 363, 'url' => '/mp/2/test_current-mp/test_westminster_constituency/divisions' ) );
20
+        return $this->fetch_page(array('pagetype' => 'divisions', 'pid' => 2, 'policy' => 363, 'url' => '/mp/2/test_current-mp/test_westminster_constituency/divisions'));
21 21
     }
22 22
 
23 23
     private function fetch_mp_recent_page()
24 24
     {
25
-        $vars = array( 'pagetype' => 'recent', 'pid' => 2, 'url' => '/mp/2/test_current-mp/test_westminster_constituency/recent' );
25
+        $vars = array('pagetype' => 'recent', 'pid' => 2, 'url' => '/mp/2/test_current-mp/test_westminster_constituency/recent');
26 26
         return $this->base_fetch_page($vars, 'mp', 'index.php', '/mp/recent.php');
27 27
     }
28 28
 
29 29
     private function fetch_recent_page() {
30
-        return $this->base_fetch_page( array('url' => '/divisions' ), 'divisions', 'index.php', '/divisions/index.php' );
30
+        return $this->base_fetch_page(array('url' => '/divisions'), 'divisions', 'index.php', '/divisions/index.php');
31 31
     }
32 32
 
33 33
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
     }
114 114
 
115 115
     public function testNotEnoughInfoStatement() {
116
-        return $this->fetch_page( array( 'pagetype' => 'divisions', 'pid' => 2, 'policy' => 810, 'url' => '/mp/2/test_current-mp/test_westminster_constituency/divisions' ) );
116
+        return $this->fetch_page(array('pagetype' => 'divisions', 'pid' => 2, 'policy' => 810, 'url' => '/mp/2/test_current-mp/test_westminster_constituency/divisions'));
117 117
         $this->assertContains('we don&rsquo;t have enough information to calculate Test Current-MP&rsquo;s position', $page);
118 118
     }
119 119
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
     }
125 125
 
126 126
     public function testSingleDivision() {
127
-        $page = $this->base_fetch_page( array('url' => '/divisions/division.php', 'vote' => 'pw-3012-01-01-1-commons' ), 'divisions', 'division.php', '/divisions/division.php' );
127
+        $page = $this->base_fetch_page(array('url' => '/divisions/division.php', 'vote' => 'pw-3012-01-01-1-commons'), 'divisions', 'division.php', '/divisions/division.php');
128 128
         $this->assertContains('A majority of MPs  <b>voted in favour</b> of a thing', $page);
129 129
         $this->assertContains('198 for', $page);
130 130
         $this->assertContains('98 against', $page);
Please login to merge, or discard this patch.