@@ -221,7 +221,7 @@ |
||
221 | 221 | */ |
222 | 222 | public static function getMime($extension) |
223 | 223 | { |
224 | - if(isset(self::$mimeTypes[$extension])) { |
|
224 | + if (isset(self::$mimeTypes[$extension])) { |
|
225 | 225 | return self::$mimeTypes[$extension]; |
226 | 226 | } |
227 | 227 |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | { |
106 | 106 | $name = $this->getName(); |
107 | 107 | |
108 | - if($this->info->hasNamespace()) { |
|
108 | + if ($this->info->hasNamespace()) { |
|
109 | 109 | $name = $this->info->getNamespace().'\\'.$this->name; |
110 | 110 | } |
111 | 111 | |
@@ -160,12 +160,12 @@ discard block |
||
160 | 160 | $parts[] = 'class'; |
161 | 161 | $parts[] = $this->getName(); |
162 | 162 | |
163 | - if(!empty($this->extends)) { |
|
163 | + if (!empty($this->extends)) { |
|
164 | 164 | $parts[] = 'extends'; |
165 | 165 | $parts[] = $this->extends; |
166 | 166 | } |
167 | 167 | |
168 | - if(!empty($this->implements)) { |
|
168 | + if (!empty($this->implements)) { |
|
169 | 169 | $parts[] = 'implements'; |
170 | 170 | $parts[] = implode(', ', $this->implements); |
171 | 171 | } |
@@ -184,9 +184,9 @@ discard block |
||
184 | 184 | |
185 | 185 | protected function analyzeCode() |
186 | 186 | { |
187 | - if($this->keyword == 'abstract') { |
|
187 | + if ($this->keyword == 'abstract') { |
|
188 | 188 | $this->abstract = true; |
189 | - } else if($this->keyword == 'final') { |
|
189 | + } else if ($this->keyword == 'final') { |
|
190 | 190 | $this->final = true; |
191 | 191 | } |
192 | 192 | |
@@ -203,16 +203,16 @@ discard block |
||
203 | 203 | |
204 | 204 | $tokenName = 'none'; |
205 | 205 | |
206 | - foreach($parts as $part) |
|
206 | + foreach ($parts as $part) |
|
207 | 207 | { |
208 | 208 | $part = str_replace(',', '', $part); |
209 | 209 | $part = trim($part); |
210 | - if(empty($part)) { |
|
210 | + if (empty($part)) { |
|
211 | 211 | continue; |
212 | 212 | } |
213 | 213 | |
214 | 214 | $name = strtolower($part); |
215 | - if($name == 'extends' || $name == 'implements') { |
|
215 | + if ($name == 'extends' || $name == 'implements') { |
|
216 | 216 | $tokenName = $name; |
217 | 217 | continue; |
218 | 218 | } |
@@ -222,13 +222,13 @@ discard block |
||
222 | 222 | |
223 | 223 | $this->implements = $tokens['implements']; |
224 | 224 | |
225 | - if(!empty($this->implements)) { |
|
225 | + if (!empty($this->implements)) { |
|
226 | 226 | usort($this->implements, function(string $a, string $b) { |
227 | 227 | return strnatcasecmp($a, $b); |
228 | 228 | }); |
229 | 229 | } |
230 | 230 | |
231 | - if(!empty($tokens['extends'])) { |
|
231 | + if (!empty($tokens['extends'])) { |
|
232 | 232 | $this->extends = $tokens['extends'][0]; |
233 | 233 | } |
234 | 234 | } |
@@ -18,23 +18,23 @@ discard block |
||
18 | 18 | |
19 | 19 | public function __construct(array $size) |
20 | 20 | { |
21 | - if(!isset($size['width'])) { |
|
21 | + if (!isset($size['width'])) { |
|
22 | 22 | $size['width'] = $size[0]; |
23 | 23 | } |
24 | 24 | |
25 | - if(!isset($size['height'])) { |
|
25 | + if (!isset($size['height'])) { |
|
26 | 26 | $size['height'] = $size[1]; |
27 | 27 | } |
28 | 28 | |
29 | - if(!isset($size[0])) { |
|
29 | + if (!isset($size[0])) { |
|
30 | 30 | $size[0] = $size['width']; |
31 | 31 | } |
32 | 32 | |
33 | - if(!isset($size[1])) { |
|
33 | + if (!isset($size[1])) { |
|
34 | 34 | $size[1] = $size['height']; |
35 | 35 | } |
36 | 36 | |
37 | - if(!isset($size['channels'])) { |
|
37 | + if (!isset($size['channels'])) { |
|
38 | 38 | $size['channels'] = 1; |
39 | 39 | } |
40 | 40 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | |
69 | 69 | public function offsetGet($offset) |
70 | 70 | { |
71 | - if(isset($this->size[$offset])) { |
|
71 | + if (isset($this->size[$offset])) { |
|
72 | 72 | return $this->size[$offset]; |
73 | 73 | } |
74 | 74 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | public function offsetSet($offset, $value) |
79 | 79 | { |
80 | - if(is_null($offset)) { |
|
80 | + if (is_null($offset)) { |
|
81 | 81 | $this->size[] = $value; |
82 | 82 | } else { |
83 | 83 | $this->size[$offset] = $value; |
@@ -42,7 +42,7 @@ |
||
42 | 42 | <br> |
43 | 43 | <?php |
44 | 44 | |
45 | - foreach($urls as $url) |
|
45 | + foreach ($urls as $url) |
|
46 | 46 | { |
47 | 47 | $info = parseURL($url); |
48 | 48 |
@@ -12,7 +12,7 @@ |
||
12 | 12 | $autoload = realpath($root.'/../vendor/autoload.php'); |
13 | 13 | |
14 | 14 | // we need the autoloader to be present |
15 | - if($autoload === false) |
|
15 | + if ($autoload === false) |
|
16 | 16 | { |
17 | 17 | die('<b>ERROR:</b> Autoloader not present. Run composer update first.'); |
18 | 18 | } |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | |
167 | 167 | public function isHeadersPosition($position) |
168 | 168 | { |
169 | - if($this->headersPosition === $position) { |
|
169 | + if ($this->headersPosition === $position) { |
|
170 | 170 | return true; |
171 | 171 | } |
172 | 172 | |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | self::HEADERS_TOP |
194 | 194 | ); |
195 | 195 | |
196 | - if(!in_array($position, $validPositions)) { |
|
196 | + if (!in_array($position, $validPositions)) { |
|
197 | 197 | throw new CSVHelper_Exception( |
198 | 198 | 'Invalid headers position', |
199 | 199 | sprintf( |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | */ |
250 | 250 | public function getRow($index) |
251 | 251 | { |
252 | - if(isset($this->data[$index])) { |
|
252 | + if (isset($this->data[$index])) { |
|
253 | 253 | return $this->data[$index]; |
254 | 254 | } |
255 | 255 | |
@@ -316,9 +316,9 @@ discard block |
||
316 | 316 | public function getColumn($index) |
317 | 317 | { |
318 | 318 | $data = array(); |
319 | - for($i=0; $i < $this->rowCount; $i++) { |
|
319 | + for ($i = 0; $i < $this->rowCount; $i++) { |
|
320 | 320 | $value = ''; |
321 | - if(isset($this->data[$i][$index])) { |
|
321 | + if (isset($this->data[$i][$index])) { |
|
322 | 322 | $value = $this->data[$i][$index]; |
323 | 323 | } |
324 | 324 | |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | */ |
336 | 336 | public function columnExists($index) |
337 | 337 | { |
338 | - if($index < $this->columnCount) { |
|
338 | + if ($index < $this->columnCount) { |
|
339 | 339 | return true; |
340 | 340 | } |
341 | 341 | |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | { |
347 | 347 | $this->reset(); |
348 | 348 | |
349 | - if(empty(trim($this->csv))) { |
|
349 | + if (empty(trim($this->csv))) { |
|
350 | 350 | $this->addError('Tried to parse an empty CSV string.'); |
351 | 351 | return; |
352 | 352 | } |
@@ -361,12 +361,12 @@ discard block |
||
361 | 361 | $parser->delimiter = $this->detectSeparator(); |
362 | 362 | |
363 | 363 | $result = $parser->parse_string(/** @scrutinizer ignore-type */ $this->csv); |
364 | - if(!$result) { |
|
364 | + if (!$result) { |
|
365 | 365 | $this->addError('The CSV string could not be parsed.'); |
366 | 366 | return; |
367 | 367 | } |
368 | 368 | |
369 | - switch($this->headersPosition) |
|
369 | + switch ($this->headersPosition) |
|
370 | 370 | { |
371 | 371 | case self::HEADERS_TOP: |
372 | 372 | $this->headers = array_shift($result); |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | case self::HEADERS_LEFT: |
376 | 376 | $keep = array(); |
377 | 377 | $total = count($result); |
378 | - for($i=0; $i < $total; $i++) { |
|
378 | + for ($i = 0; $i < $total; $i++) { |
|
379 | 379 | $row = $result[$i]; |
380 | 380 | $this->headers[] = array_shift($row); |
381 | 381 | $keep[] = $row; |
@@ -388,9 +388,9 @@ discard block |
||
388 | 388 | $this->data = $result; |
389 | 389 | $this->rowCount = count($this->data); |
390 | 390 | |
391 | - for($i=0; $i < $this->rowCount; $i++) { |
|
391 | + for ($i = 0; $i < $this->rowCount; $i++) { |
|
392 | 392 | $amount = count($this->data[$i]); |
393 | - if($amount > $this->columnCount) { |
|
393 | + if ($amount > $this->columnCount) { |
|
394 | 394 | $this->columnCount = $amount; |
395 | 395 | } |
396 | 396 | } |
@@ -434,8 +434,8 @@ discard block |
||
434 | 434 | ',,' => ',' |
435 | 435 | ); |
436 | 436 | |
437 | - foreach($search as $char => $separator) { |
|
438 | - if(strstr($this->csv, $char)) { |
|
437 | + foreach ($search as $char => $separator) { |
|
438 | + if (strstr($this->csv, $char)) { |
|
439 | 439 | return $separator; |
440 | 440 | } |
441 | 441 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | public function getNextPage() : int |
115 | 115 | { |
116 | - if($this->next === 0) { |
|
116 | + if ($this->next === 0) { |
|
117 | 117 | return $this->last; |
118 | 118 | } |
119 | 119 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | */ |
138 | 138 | public function getPreviousPage() : int |
139 | 139 | { |
140 | - if($this->prev === 0) { |
|
140 | + if ($this->prev === 0) { |
|
141 | 141 | return 1; |
142 | 142 | } |
143 | 143 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | // adjust the adjacent value if it exceeds the |
183 | 183 | // total amount of pages |
184 | 184 | $adjacentTotal = ($adjacent * 2) + 1; |
185 | - if($adjacentTotal > $this->last) |
|
185 | + if ($adjacentTotal > $this->last) |
|
186 | 186 | { |
187 | 187 | $adjacent = (int)floor($this->last / 2); |
188 | 188 | } |
@@ -195,13 +195,13 @@ discard block |
||
195 | 195 | $back = 0; |
196 | 196 | $fwd = 0; |
197 | 197 | |
198 | - if($maxBack >= $adjacent) { |
|
198 | + if ($maxBack >= $adjacent) { |
|
199 | 199 | $back = $adjacent; |
200 | 200 | } else { |
201 | 201 | $back = $maxBack; |
202 | 202 | } |
203 | 203 | |
204 | - if($maxFwd >= $adjacent) { |
|
204 | + if ($maxFwd >= $adjacent) { |
|
205 | 205 | $fwd = $adjacent; |
206 | 206 | } else { |
207 | 207 | $fwd = $maxFwd; |
@@ -217,16 +217,16 @@ discard block |
||
217 | 217 | $fwd += $backDiff; |
218 | 218 | $back += $fwdDiff; |
219 | 219 | |
220 | - if($fwd > $maxFwd) { $fwd = $maxFwd; } |
|
221 | - if($back > $maxBack) { $back = $maxBack; } |
|
220 | + if ($fwd > $maxFwd) { $fwd = $maxFwd; } |
|
221 | + if ($back > $maxBack) { $back = $maxBack; } |
|
222 | 222 | |
223 | 223 | // calculate the first and last page in the list |
224 | 224 | $prev = $this->current - $back; |
225 | 225 | $next = $this->current + $fwd; |
226 | 226 | |
227 | 227 | // failsafe so we stay within the bounds |
228 | - if($prev < 1) { $prev = 1; } |
|
229 | - if($next > $this->last) { $next = $this->last; } |
|
228 | + if ($prev < 1) { $prev = 1; } |
|
229 | + if ($next > $this->last) { $next = $this->last; } |
|
230 | 230 | |
231 | 231 | // create and return the page numbers list |
232 | 232 | $numbers = range($prev, $next); |
@@ -319,11 +319,11 @@ discard block |
||
319 | 319 | { |
320 | 320 | $pages = (int)ceil($this->total / $this->perPage); |
321 | 321 | |
322 | - if($this->current < 1) |
|
322 | + if ($this->current < 1) |
|
323 | 323 | { |
324 | 324 | $this->current = 1; |
325 | 325 | } |
326 | - else if($this->current > $pages) |
|
326 | + else if ($this->current > $pages) |
|
327 | 327 | { |
328 | 328 | $this->current = $pages; |
329 | 329 | } |
@@ -331,19 +331,19 @@ discard block |
||
331 | 331 | $this->last = $pages; |
332 | 332 | |
333 | 333 | $nextPage = $this->current + 1; |
334 | - if($nextPage <= $pages) { |
|
334 | + if ($nextPage <= $pages) { |
|
335 | 335 | $this->next = $nextPage; |
336 | 336 | } |
337 | 337 | |
338 | 338 | $prevPage = $this->current - 1; |
339 | - if($prevPage > 0) { |
|
339 | + if ($prevPage > 0) { |
|
340 | 340 | $this->prev = $prevPage; |
341 | 341 | } |
342 | 342 | |
343 | 343 | $this->offsetStart = ($this->current - 1) * $this->perPage; |
344 | 344 | |
345 | 345 | $this->offsetEnd = $this->offsetStart + $this->perPage; |
346 | - if($this->offsetEnd > ($this->total - 1)) { |
|
346 | + if ($this->offsetEnd > ($this->total - 1)) { |
|
347 | 347 | $this->offsetEnd = ($this->total - 1); |
348 | 348 | } |
349 | 349 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @param int $code |
32 | 32 | * @param \Exception $previous |
33 | 33 | */ |
34 | - public function __construct(string $message, $details=null, $code=null, $previous=null) |
|
34 | + public function __construct(string $message, $details = null, $code = null, $previous = null) |
|
35 | 35 | { |
36 | 36 | parent::__construct($message, $code, $previous); |
37 | 37 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function getDetails() : string |
46 | 46 | { |
47 | - if($this->details !== null) { |
|
47 | + if ($this->details !== null) { |
|
48 | 48 | return $this->details; |
49 | 49 | } |
50 | 50 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function display() |
59 | 59 | { |
60 | - if(!headers_sent()) { |
|
60 | + if (!headers_sent()) { |
|
61 | 61 | header('Content-type:text/plain; charset=utf-8'); |
62 | 62 | } |
63 | 63 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | { |
86 | 86 | throw new BaseException(''); |
87 | 87 | } |
88 | - catch(BaseException $e) |
|
88 | + catch (BaseException $e) |
|
89 | 89 | { |
90 | 90 | echo self::createInfo($e)->toString(); |
91 | 91 | } |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | { |
101 | 101 | throw new BaseException(''); |
102 | 102 | } |
103 | - catch(BaseException $e) |
|
103 | + catch (BaseException $e) |
|
104 | 104 | { |
105 | 105 | echo '<pre style="background:#fff;font-family:monospace;font-size:14px;color:#444;padding:16px;border:solid 1px #999;border-radius:4px;">'; |
106 | 106 | echo self::createInfo($e)->toString(); |
@@ -35,12 +35,12 @@ discard block |
||
35 | 35 | { |
36 | 36 | $section = $this->addSection(self::SECTION_DEFAULT); |
37 | 37 | |
38 | - if(empty($iniString)) { |
|
38 | + if (empty($iniString)) { |
|
39 | 39 | return; |
40 | 40 | } |
41 | 41 | |
42 | 42 | $eol = ConvertHelper::detectEOLCharacter($iniString); |
43 | - if($eol !== null) { |
|
43 | + if ($eol !== null) { |
|
44 | 44 | $this->eol = $eol->getCharacter(); |
45 | 45 | } |
46 | 46 | |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | |
49 | 49 | $total = count($lines); |
50 | 50 | |
51 | - for($i=0; $i < $total; $i++) |
|
51 | + for ($i = 0; $i < $total; $i++) |
|
52 | 52 | { |
53 | 53 | $line = new IniHelper_Line($lines[$i], $i); |
54 | 54 | |
55 | - if($line->isSection()) { |
|
55 | + if ($line->isSection()) { |
|
56 | 56 | $section = $this->addSection($line->getSectionName()); |
57 | 57 | } |
58 | 58 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $iniPath = FileHelper::requireFileExists($iniPath); |
83 | 83 | |
84 | 84 | $content = file_get_contents($iniPath); |
85 | - if($content !== false) { |
|
85 | + if ($content !== false) { |
|
86 | 86 | return self::createFromString($content); |
87 | 87 | } |
88 | 88 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | */ |
128 | 128 | public function addSection(string $name) : IniHelper_Section |
129 | 129 | { |
130 | - if(!isset($this->sections[$name])) { |
|
130 | + if (!isset($this->sections[$name])) { |
|
131 | 131 | $this->sections[$name] = new IniHelper_Section($this, $name); |
132 | 132 | } |
133 | 133 | |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | */ |
143 | 143 | public function getSection(string $name) : ?IniHelper_Section |
144 | 144 | { |
145 | - if(isset($this->sections[$name])) { |
|
145 | + if (isset($this->sections[$name])) { |
|
146 | 146 | return $this->sections[$name]; |
147 | 147 | } |
148 | 148 | |
@@ -158,9 +158,9 @@ discard block |
||
158 | 158 | { |
159 | 159 | $result = array(); |
160 | 160 | |
161 | - foreach($this->sections as $section) |
|
161 | + foreach ($this->sections as $section) |
|
162 | 162 | { |
163 | - if($section->isDefault()) |
|
163 | + if ($section->isDefault()) |
|
164 | 164 | { |
165 | 165 | $result = array_merge($result, $section->toArray()); |
166 | 166 | } |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | { |
201 | 201 | $parts = array(); |
202 | 202 | |
203 | - foreach($this->sections as $section) |
|
203 | + foreach ($this->sections as $section) |
|
204 | 204 | { |
205 | 205 | $parts[] = $section->toString(); |
206 | 206 | } |
@@ -243,8 +243,8 @@ discard block |
||
243 | 243 | */ |
244 | 244 | public function sectionExists(string $name) : bool |
245 | 245 | { |
246 | - foreach($this->sections as $section) { |
|
247 | - if($section->getName() === $name) { |
|
246 | + foreach ($this->sections as $section) { |
|
247 | + if ($section->getName() === $name) { |
|
248 | 248 | return true; |
249 | 249 | } |
250 | 250 | } |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | { |
274 | 274 | $path = $this->parsePath($path); |
275 | 275 | |
276 | - if(!$this->sectionExists($path['section'])) { |
|
276 | + if (!$this->sectionExists($path['section'])) { |
|
277 | 277 | return array(); |
278 | 278 | } |
279 | 279 | |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | { |
285 | 285 | $path = explode($this->pathSeparator, $path); |
286 | 286 | |
287 | - if(count($path) === 1) |
|
287 | + if (count($path) === 1) |
|
288 | 288 | { |
289 | 289 | return array( |
290 | 290 | 'section' => self::SECTION_DEFAULT, |