@@ -53,7 +53,8 @@ |
||
53 | 53 | $this->session->keep_flashdata('referred_from'); |
54 | 54 | if($prevURL = $this->session->flashdata('referred_from')) { |
55 | 55 | redirect($prevURL); |
56 | - } else { //@codeCoverageIgnore |
|
56 | + } else { |
|
57 | +//@codeCoverageIgnore |
|
57 | 58 | redirect('/'); //TODO (CHECK): Should this be refresh? |
58 | 59 | } //@codeCoverageIgnore |
59 | 60 | } else { |
@@ -114,11 +114,15 @@ |
||
114 | 114 | |
115 | 115 | if($sortOrder == 'asc') { |
116 | 116 | $unreadSort = ($a_text <=> $b_text); |
117 | - if($unreadSort) return $unreadSort; |
|
117 | + if($unreadSort) { |
|
118 | + return $unreadSort; |
|
119 | + } |
|
118 | 120 | return $a_text2 <=> $b_text2; |
119 | 121 | } else { |
120 | 122 | $unreadSort = ($a_text <=> $b_text); |
121 | - if($unreadSort) return $unreadSort; |
|
123 | + if($unreadSort) { |
|
124 | + return $unreadSort; |
|
125 | + } |
|
122 | 126 | return $b_text2 <=> $a_text2; |
123 | 127 | } |
124 | 128 | }); |
@@ -114,7 +114,9 @@ discard block |
||
114 | 114 | */ |
115 | 115 | final public function isValidTitleURL(string $title_url) : bool { |
116 | 116 | $success = (bool) preg_match($this->titleFormat, $title_url); |
117 | - if(!$success) log_message('error', "Invalid Title URL ({$this->site}): {$title_url}"); |
|
117 | + if(!$success) { |
|
118 | + log_message('error', "Invalid Title URL ({$this->site}): {$title_url}"); |
|
119 | + } |
|
118 | 120 | return $success; |
119 | 121 | } |
120 | 122 | |
@@ -128,7 +130,9 @@ discard block |
||
128 | 130 | */ |
129 | 131 | final public function isValidChapter(string $chapter) : bool { |
130 | 132 | $success = (bool) preg_match($this->chapterFormat, $chapter); |
131 | - if(!$success) log_message('error', "Invalid Chapter ({$this->site}): {$chapter}"); |
|
133 | + if(!$success) { |
|
134 | + log_message('error', "Invalid Chapter ({$this->site}): {$chapter}"); |
|
135 | + } |
|
132 | 136 | return $success; |
133 | 137 | } |
134 | 138 | |
@@ -157,14 +161,20 @@ discard block |
||
157 | 161 | //curl_setopt($ch, CURLOPT_VERBOSE, 1); |
158 | 162 | curl_setopt($ch, CURLOPT_HEADER, 1); |
159 | 163 | |
160 | - if($follow_redirect) curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); |
|
164 | + if($follow_redirect) { |
|
165 | + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); |
|
166 | + } |
|
161 | 167 | |
162 | 168 | if($cookies = $this->cache->get("cloudflare_{$this->site}")) { |
163 | 169 | $cookie_string .= "; {$cookies}"; |
164 | 170 | } |
165 | 171 | |
166 | - if(!empty($cookie_string)) curl_setopt($ch, CURLOPT_COOKIE, $cookie_string); |
|
167 | - if(!empty($cookiejar_path)) curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar_path); |
|
172 | + if(!empty($cookie_string)) { |
|
173 | + curl_setopt($ch, CURLOPT_COOKIE, $cookie_string); |
|
174 | + } |
|
175 | + if(!empty($cookiejar_path)) { |
|
176 | + curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar_path); |
|
177 | + } |
|
168 | 178 | |
169 | 179 | //Some sites check the useragent for stuff, use a pre-defined user-agent to avoid stuff. |
170 | 180 | curl_setopt($ch, CURLOPT_USERAGENT, $this->userAgent); |
@@ -192,7 +202,9 @@ discard block |
||
192 | 202 | $body = substr($response, $header_size); |
193 | 203 | curl_close($ch); |
194 | 204 | |
195 | - if($status_code === 503) $refresh = $this->handleCloudFlare($url, $body); |
|
205 | + if($status_code === 503) { |
|
206 | + $refresh = $this->handleCloudFlare($url, $body); |
|
207 | + } |
|
196 | 208 | } |
197 | 209 | |
198 | 210 | return [ |
@@ -405,8 +417,12 @@ discard block |
||
405 | 417 | $status = FALSE; |
406 | 418 | |
407 | 419 | //Make sure we have a volume element |
408 | - if(count($oldChapterSegments) === 1) array_unshift($oldChapterSegments, 'v0'); |
|
409 | - if(count($newChapterSegments) === 1) array_unshift($newChapterSegments, 'v0'); |
|
420 | + if(count($oldChapterSegments) === 1) { |
|
421 | + array_unshift($oldChapterSegments, 'v0'); |
|
422 | + } |
|
423 | + if(count($newChapterSegments) === 1) { |
|
424 | + array_unshift($newChapterSegments, 'v0'); |
|
425 | + } |
|
410 | 426 | |
411 | 427 | $oldCount = count($oldChapterSegments); |
412 | 428 | $newCount = count($newChapterSegments); |
@@ -419,8 +435,12 @@ discard block |
||
419 | 435 | $newVolume = substr(array_shift($newChapterSegments), 1); |
420 | 436 | |
421 | 437 | //Forcing volume to 0 as TBD might not be the latest (although it can be, but that is covered by other checks) |
422 | - if(in_array($oldVolume, ['TBD', 'TBA', 'NA', 'LMT'])) $oldVolume = 0; |
|
423 | - if(in_array($newVolume, ['TBD', 'TBA', 'NA', 'LMT'])) $newVolume = 0; |
|
438 | + if(in_array($oldVolume, ['TBD', 'TBA', 'NA', 'LMT'])) { |
|
439 | + $oldVolume = 0; |
|
440 | + } |
|
441 | + if(in_array($newVolume, ['TBD', 'TBA', 'NA', 'LMT'])) { |
|
442 | + $newVolume = 0; |
|
443 | + } |
|
424 | 444 | |
425 | 445 | $oldVolume = floatval($oldVolume); |
426 | 446 | $newVolume = floatval($newVolume); |
@@ -23,7 +23,9 @@ |
||
23 | 23 | $this->body_data['totalPages'] = $historyData['totalPages']; |
24 | 24 | $this->body_data['titleID'] = (int) $titleID; |
25 | 25 | |
26 | - if($page > $this->body_data['totalPages'] && $page > 1) redirect("/history/{$titleID}/1"); |
|
26 | + if($page > $this->body_data['totalPages'] && $page > 1) { |
|
27 | + redirect("/history/{$titleID}/1"); |
|
28 | + } |
|
27 | 29 | |
28 | 30 | $this->_render_page("TitleHistory"); |
29 | 31 |
@@ -1,6 +1,8 @@ discard block |
||
1 | 1 | <?php declare(strict_types=1); |
2 | 2 | |
3 | -if(!extension_loaded('gd')) die('GD ext is required to run this!'); |
|
3 | +if(!extension_loaded('gd')) { |
|
4 | + die('GD ext is required to run this!'); |
|
5 | +} |
|
4 | 6 | |
5 | 7 | chdir(dirname(__FILE__).'/../'); //Just to make things easier, change dir to project root. |
6 | 8 | |
@@ -9,7 +11,7 @@ discard block |
||
9 | 11 | private $className; |
10 | 12 | |
11 | 13 | public function __construct() { |
12 | - if(isset($_SERVER['argv']) && count($_SERVER['argv']) === 3){ |
|
14 | + if(isset($_SERVER['argv']) && count($_SERVER['argv']) === 3) { |
|
13 | 15 | $this->baseURL = rtrim($_SERVER['argv'][1], '/'); |
14 | 16 | $this->className = $_SERVER['argv'][2]; |
15 | 17 | |
@@ -98,7 +100,9 @@ discard block |
||
98 | 100 | $baseFile = file_get_contents($baseFileName); |
99 | 101 | |
100 | 102 | $parse = parse_url($this->baseURL); |
101 | - if(strpos($baseFile, $parse['host']) !== false) die("Domain already exists in userscript?"); |
|
103 | + if(strpos($baseFile, $parse['host']) !== false) { |
|
104 | + die("Domain already exists in userscript?"); |
|
105 | + } |
|
102 | 106 | |
103 | 107 | preg_match('/\@updated ([0-9\-]+)[\r\n]+.*?\@version ([0-9\.]+)/s', $baseFile, $matches); |
104 | 108 | |
@@ -188,7 +192,9 @@ discard block |
||
188 | 192 | } |
189 | 193 | } |
190 | 194 | |
191 | - if(empty($titleArr)) die("API isn't returning any titles?"); |
|
195 | + if(empty($titleArr)) { |
|
196 | + die("API isn't returning any titles?"); |
|
197 | + } |
|
192 | 198 | return $titleArr; |
193 | 199 | } |
194 | 200 | } |
@@ -67,8 +67,7 @@ discard block |
||
67 | 67 | // detect and register all PHP errors in this log hence forth |
68 | 68 | ErrorHandler::register($this->log); |
69 | 69 | |
70 | - if ($this->config['introspection_processor']) |
|
71 | - { |
|
70 | + if ($this->config['introspection_processor']) { |
|
72 | 71 | // add controller and line number info to each log message |
73 | 72 | // 2 = depth in the stacktrace to ignore. This gives us the file |
74 | 73 | // making the call to log_message(); |
@@ -76,10 +75,8 @@ discard block |
||
76 | 75 | } |
77 | 76 | |
78 | 77 | // decide which handler(s) to use |
79 | - foreach ($this->config['handlers'] as $value) |
|
80 | - { |
|
81 | - switch ($value) |
|
82 | - { |
|
78 | + foreach ($this->config['handlers'] as $value) { |
|
79 | + switch ($value) { |
|
83 | 80 | case 'file': |
84 | 81 | $handler = new RotatingFileHandler($this->config['file_logfile']); |
85 | 82 | $formatter = new LineFormatter(null, null, $config['file_multiline']); |
@@ -140,35 +137,28 @@ discard block |
||
140 | 137 | * @param $msg |
141 | 138 | * @return bool |
142 | 139 | */ |
143 | - public function write_log($level = 'error', $msg) |
|
144 | - { |
|
140 | + public function write_log($level = 'error', $msg) { |
|
145 | 141 | $level = strtoupper($level); |
146 | 142 | |
147 | 143 | // verify error level |
148 | - if (!isset($this->_levels[$level])) |
|
149 | - { |
|
144 | + if (!isset($this->_levels[$level])) { |
|
150 | 145 | $this->log->addError('unknown error level: ' . $level); |
151 | 146 | $level = 'ALL'; |
152 | 147 | } |
153 | 148 | |
154 | 149 | // filter out anything in $this->config['exclusion_list'] |
155 | - if (!empty($this->config['exclusion_list'])) |
|
156 | - { |
|
157 | - foreach ($this->config['exclusion_list'] as $findme) |
|
158 | - { |
|
150 | + if (!empty($this->config['exclusion_list'])) { |
|
151 | + foreach ($this->config['exclusion_list'] as $findme) { |
|
159 | 152 | $pos = strpos($msg, $findme); |
160 | - if ($pos !== false) |
|
161 | - { |
|
153 | + if ($pos !== false) { |
|
162 | 154 | // just exit now - we don't want to log this error |
163 | 155 | return true; |
164 | 156 | } |
165 | 157 | } |
166 | 158 | } |
167 | 159 | |
168 | - if ($this->_levels[$level] <= $this->config['threshold']) |
|
169 | - { |
|
170 | - switch ($level) |
|
171 | - { |
|
160 | + if ($this->_levels[$level] <= $this->config['threshold']) { |
|
161 | + switch ($level) { |
|
172 | 162 | case 'ERROR': |
173 | 163 | $this->log->addError($msg); |
174 | 164 | break; |