Failed Conditions
Pull Request — master (#1327)
by Nick
11:49
created
www/includes/easyparliament/templates/html/comments_recent.php 2 patches
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,7 +18,9 @@  discard block
 block discarded – undo
18 18
     }
19 19
     $PAGE->block_start(array('id'=>'recentcomments', 'title'=>$title));
20 20
 
21
-    if ($this_page != 'home') $PAGE->page_links($data);
21
+    if ($this_page != 'home') {
22
+        $PAGE->page_links($data);
23
+    }
22 24
     $USERURL = new \MySociety\TheyWorkForYou\Url('userview');
23 25
     ?>
24 26
                         <ul>
@@ -50,7 +52,9 @@  discard block
 block discarded – undo
50 52
                         <p><a href="<?php echo $MOREURL->generate(); ?>#c<?php echo count($data['comments'])+1; ?>">See more annotations posted recently</a></p>
51 53
 <?php
52 54
     }
53
-    if ($this_page != 'home') $PAGE->page_links($data);
55
+    if ($this_page != 'home') {
56
+        $PAGE->page_links($data);
57
+    }
54 58
     $PAGE->block_end();
55 59
 }
56 60
 ?>
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         $date = format_date($date, SHORTDATEFORMAT);
34 34
         $time = format_time($time, TIMEFORMAT);
35 35
 
36
-        $count = $n+1;
36
+        $count = $n + 1;
37 37
 
38 38
         $USERURL->insert(array('u'=>$comment['user_id']));
39 39
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     if ($this_page == 'home') {
48 48
         $MOREURL = new \MySociety\TheyWorkForYou\Url('comments_recent');
49 49
         ?>
50
-                        <p><a href="<?php echo $MOREURL->generate(); ?>#c<?php echo count($data['comments'])+1; ?>">See more annotations posted recently</a></p>
50
+                        <p><a href="<?php echo $MOREURL->generate(); ?>#c<?php echo count($data['comments']) + 1; ?>">See more annotations posted recently</a></p>
51 51
 <?php
52 52
     }
53 53
     if ($this_page != 'home') $PAGE->page_links($data);
Please login to merge, or discard this patch.
classes/Url.php 3 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -156,8 +156,9 @@
 block discarded – undo
156 156
                 foreach ($var as $v) {
157 157
                     $url_args[] = "$key=" . urlencode(stripslashes($v));
158 158
                 }
159
-            } elseif ($var != null)
160
-                $url_args[] = "$key=" . urlencode(stripslashes($var));
159
+            } elseif ($var != null) {
160
+                            $url_args[] = "$key=" . urlencode(stripslashes($var));
161
+            }
161 162
         }
162 163
 
163 164
         $page_url = WEBPATH . $DATA->page_metadata($this->destinationpage, "url");
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@
 block discarded – undo
114 114
     /**
115 115
      * Remove Session Key/Value Pair
116 116
      *
117
-     * @param array $arr A list array of key names to remove
117
+     * @param string[] $arr A list array of key names to remove
118 118
      */
119 119
 
120 120
     public function remove($arr) {
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
         // These stores an associative array of key/value pairs that
44 44
         // we'll want passed on to other pages.
45
-        $this->session_vars = array ();
45
+        $this->session_vars = array();
46 46
 
47 47
         // Prevent things using $DATA running if it hasn't been set, ie in testing
48 48
         if (isset($DATA)) {
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 
94 94
     public function reset() {
95 95
         // Call this to remove all the session_vars.
96
-        $this->session_vars = array ();
96
+        $this->session_vars = array();
97 97
     }
98 98
 
99 99
     /**
@@ -162,11 +162,11 @@  discard block
 block discarded – undo
162 162
      *                            override just one or two of them.
163 163
      */
164 164
 
165
-    public function generate($encode = "html", $overrideVars=array()) {
165
+    public function generate($encode = "html", $overrideVars = array()) {
166 166
 
167 167
         global $DATA;
168 168
 
169
-        $url_args = array ();
169
+        $url_args = array();
170 170
 
171 171
         foreach (array_merge($this->session_vars, $overrideVars) as $key => $var) {
172 172
             if (is_array($var)) {
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.