@@ -16,8 +16,7 @@ |
||
16 | 16 | * |
17 | 17 | * @SuppressWarnings(PHPMD) |
18 | 18 | */ |
19 | -class AcceptanceTester extends \Codeception\Actor |
|
20 | -{ |
|
19 | +class AcceptanceTester extends \Codeception\Actor { |
|
21 | 20 | use _generated\AcceptanceTesterActions; |
22 | 21 | |
23 | 22 | /** |
@@ -16,8 +16,7 @@ |
||
16 | 16 | * |
17 | 17 | * @SuppressWarnings(PHPMD) |
18 | 18 | */ |
19 | -class FunctionalTester extends \Codeception\Actor |
|
20 | -{ |
|
19 | +class FunctionalTester extends \Codeception\Actor { |
|
21 | 20 | use _generated\FunctionalTesterActions; |
22 | 21 | |
23 | 22 | /** |
@@ -30,8 +30,7 @@ discard block |
||
30 | 30 | public function valid_password(string $password) : bool { |
31 | 31 | if(!($isValid = $this->min_length($password, $this->CI->config->item('min_password_length', 'ion_auth')))) { |
32 | 32 | $this->set_message('valid_password', 'The password is too short!'); |
33 | - } |
|
34 | - elseif(!($isValid = $this->max_length($password, $this->CI->config->item('max_password_length', 'ion_auth')))) { |
|
33 | + } elseif(!($isValid = $this->max_length($password, $this->CI->config->item('max_password_length', 'ion_auth')))) { |
|
35 | 34 | $this->set_message('valid_password', 'The password is too long!'); |
36 | 35 | } |
37 | 36 | return $isValid; |
@@ -91,7 +90,7 @@ discard block |
||
91 | 90 | */ |
92 | 91 | public function isRuleValid(string $ruleName) : bool { |
93 | 92 | $isValid = FALSE; |
94 | - if(is_string($ruleName) && $this->has_rule($ruleName)){ |
|
93 | + if(is_string($ruleName) && $this->has_rule($ruleName)) { |
|
95 | 94 | $isValid = !in_array($ruleName, array_keys($this->error_array()), TRUE); |
96 | 95 | } |
97 | 96 | return $isValid; |
@@ -137,7 +137,9 @@ discard block |
||
137 | 137 | } |
138 | 138 | |
139 | 139 | $success = $this->set_db($idData, $valueData); |
140 | - if($success) $this->session->unset_tempdata("option_{$option}"); |
|
140 | + if($success) { |
|
141 | + $this->session->unset_tempdata("option_{$option}"); |
|
142 | + } |
|
141 | 143 | } else { |
142 | 144 | $success = FALSE; |
143 | 145 | } |
@@ -164,7 +166,9 @@ discard block |
||
164 | 166 | } |
165 | 167 | |
166 | 168 | //Overall fallback method. |
167 | - if(!isset($value)) $value = $this->options[$option]['default']; |
|
169 | + if(!isset($value)) { |
|
170 | + $value = $this->options[$option]['default']; |
|
171 | + } |
|
168 | 172 | } else { |
169 | 173 | $value = FALSE; |
170 | 174 | } |
@@ -215,7 +219,10 @@ discard block |
||
215 | 219 | //This should never happen. |
216 | 220 | break; |
217 | 221 | } |
218 | - if(!isset($value)) $value = FALSE; //FIXME: This won't play nice with BOOL type false? |
|
222 | + if(!isset($value)) { |
|
223 | + $value = FALSE; |
|
224 | + } |
|
225 | + //FIXME: This won't play nice with BOOL type false? |
|
219 | 226 | |
220 | 227 | return $value; |
221 | 228 | } |
@@ -35,9 +35,13 @@ |
||
35 | 35 | $titleID = $id; |
36 | 36 | } else { |
37 | 37 | //TODO: Check if title is valid URL! |
38 | - if($create) $titleID = $this->addTitle($titleURL, $siteID); |
|
38 | + if($create) { |
|
39 | + $titleID = $this->addTitle($titleURL, $siteID); |
|
40 | + } |
|
41 | + } |
|
42 | + if(!isset($titleID) || !$titleID) { |
|
43 | + $titleID = 0; |
|
39 | 44 | } |
40 | - if(!isset($titleID) || !$titleID) $titleID = 0; |
|
41 | 45 | |
42 | 46 | return ($returnData && $titleID !== 0 ? $query->row_array() : $titleID); |
43 | 47 | } |
@@ -6,7 +6,9 @@ discard block |
||
6 | 6 | } |
7 | 7 | |
8 | 8 | public function index(int $page = 1) : void { |
9 | - if($page === 0) redirect('user/history/1'); |
|
9 | + if($page === 0) { |
|
10 | + redirect('user/history/1'); |
|
11 | + } |
|
10 | 12 | |
11 | 13 | $this->header_data['title'] = "History"; |
12 | 14 | $this->header_data['page'] = "history"; |
@@ -16,7 +18,9 @@ discard block |
||
16 | 18 | $this->body_data['currentPage'] = (int) $page; |
17 | 19 | $this->body_data['totalPages'] = $historyData['totalPages']; |
18 | 20 | |
19 | - if($page > $this->body_data['totalPages'] && $page > 1) redirect('user/history/1'); |
|
21 | + if($page > $this->body_data['totalPages'] && $page > 1) { |
|
22 | + redirect('user/history/1'); |
|
23 | + } |
|
20 | 24 | |
21 | 25 | $this->_render_page('User/History'); |
22 | 26 | } |
@@ -60,7 +60,9 @@ |
||
60 | 60 | $show_404 = TRUE; |
61 | 61 | } |
62 | 62 | |
63 | - if($show_404) show_404(); |
|
63 | + if($show_404) { |
|
64 | + show_404(); |
|
65 | + } |
|
64 | 66 | } |
65 | 67 | |
66 | 68 | private function _walk_recursive_remove (array $array, callable $callback) : array { |
@@ -6,7 +6,9 @@ discard block |
||
6 | 6 | } |
7 | 7 | |
8 | 8 | public function index(int $page = 1) : void { |
9 | - if($page === 0) redirect('user/favourites/1'); |
|
9 | + if($page === 0) { |
|
10 | + redirect('user/favourites/1'); |
|
11 | + } |
|
10 | 12 | |
11 | 13 | $this->header_data['title'] = "Favourites"; |
12 | 14 | $this->header_data['page'] = "favourites"; |
@@ -16,7 +18,9 @@ discard block |
||
16 | 18 | $this->body_data['currentPage'] = $page; |
17 | 19 | $this->body_data['totalPages'] = $favouriteData['totalPages']; |
18 | 20 | |
19 | - if($page > $this->body_data['totalPages'] && $page <= 1) redirect('user/favourites/1'); |
|
21 | + if($page > $this->body_data['totalPages'] && $page <= 1) { |
|
22 | + redirect('user/favourites/1'); |
|
23 | + } |
|
20 | 24 | |
21 | 25 | $this->_render_page('User/Favourites'); |
22 | 26 | } |
@@ -32,18 +32,19 @@ |
||
32 | 32 | return $time_string; |
33 | 33 | } |
34 | 34 | |
35 | -if (!function_exists('http_parse_headers')) { #http://www.php.net/manual/en/function.http-parse-headers.php#112917 |
|
35 | +if (!function_exists('http_parse_headers')) { |
|
36 | +#http://www.php.net/manual/en/function.http-parse-headers.php#112917 |
|
36 | 37 | function http_parse_headers (string $raw_headers) : array { |
37 | 38 | $headers = array(); // $headers = []; |
38 | 39 | foreach (explode("\n", $raw_headers) as $i => $h) { |
39 | 40 | $h = explode(':', $h, 2); |
40 | - if (isset($h[1])){ |
|
41 | - if(!isset($headers[$h[0]])){ |
|
41 | + if (isset($h[1])) { |
|
42 | + if(!isset($headers[$h[0]])) { |
|
42 | 43 | $headers[$h[0]] = trim($h[1]); |
43 | - }else if(is_array($headers[$h[0]])){ |
|
44 | + } else if(is_array($headers[$h[0]])) { |
|
44 | 45 | $tmp = array_merge($headers[$h[0]],array(trim($h[1]))); |
45 | 46 | $headers[$h[0]] = $tmp; |
46 | - }else{ |
|
47 | + } else { |
|
47 | 48 | $tmp = array_merge(array($headers[$h[0]]),array(trim($h[1]))); |
48 | 49 | $headers[$h[0]] = $tmp; |
49 | 50 | } |