@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | |
244 | 244 | if (!empty($text)) { |
245 | 245 | $fragment = $this->dom->createDocumentFragment(); |
246 | - if(!@$fragment->appendXML($text)) { |
|
246 | + if (!@$fragment->appendXML($text)) { |
|
247 | 247 | throw new XMLHelper_Exception( |
248 | 248 | 'Cannot append XML fragment', |
249 | 249 | sprintf( |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | * @param array<string,mixed> $attributes |
286 | 286 | * @return DOMNode |
287 | 287 | */ |
288 | - public function createRoot(string $name, array $attributes=array()) |
|
288 | + public function createRoot(string $name, array $attributes = array()) |
|
289 | 289 | { |
290 | 290 | $root = $this->dom->appendChild($this->dom->createElement($name)); |
291 | 291 | $this->addAttributes($root, $attributes); |
@@ -311,8 +311,8 @@ discard block |
||
311 | 311 | $string = str_replace('<', 'LT_ESCAPE', $string); |
312 | 312 | $string = str_replace('>', 'GT_ESCAPE', $string); |
313 | 313 | |
314 | - $string = str_replace(' ',' ', $string); |
|
315 | - $string = str_replace('&','&', $string); |
|
314 | + $string = str_replace(' ', ' ', $string); |
|
315 | + $string = str_replace('&', '&', $string); |
|
316 | 316 | |
317 | 317 | return $string; |
318 | 318 | } |
@@ -331,9 +331,9 @@ discard block |
||
331 | 331 | */ |
332 | 332 | public static function downloadXML(string $xml, string $filename = 'download.xml') : void |
333 | 333 | { |
334 | - if(!headers_sent() && !self::$simulation) |
|
334 | + if (!headers_sent() && !self::$simulation) |
|
335 | 335 | { |
336 | - header('Content-Disposition: attachment; filename="' . $filename . '"'); |
|
336 | + header('Content-Disposition: attachment; filename="'.$filename.'"'); |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | echo $xml; |
@@ -347,12 +347,12 @@ discard block |
||
347 | 347 | */ |
348 | 348 | public static function displayXML(string $xml) : void |
349 | 349 | { |
350 | - if(!headers_sent() && !self::$simulation) |
|
350 | + if (!headers_sent() && !self::$simulation) |
|
351 | 351 | { |
352 | 352 | header('Content-Type:text/xml; charset=utf-8'); |
353 | 353 | } |
354 | 354 | |
355 | - if(self::$simulation) |
|
355 | + if (self::$simulation) |
|
356 | 356 | { |
357 | 357 | $xml = '<pre>'.htmlspecialchars($xml).'</pre>'; |
358 | 358 | } |
@@ -370,16 +370,16 @@ discard block |
||
370 | 370 | * @param array<string,string> $customInfo Associative array with name => value pairs for custom tags to add to the output xml |
371 | 371 | * @see buildErrorXML() |
372 | 372 | */ |
373 | - public static function displayErrorXML($code, string $message, string $title, array $customInfo=array()) |
|
373 | + public static function displayErrorXML($code, string $message, string $title, array $customInfo = array()) |
|
374 | 374 | { |
375 | - if(!headers_sent() && !self::$simulation) { |
|
376 | - header('HTTP/1.1 400 Bad Request: ' . $title, true, 400); |
|
375 | + if (!headers_sent() && !self::$simulation) { |
|
376 | + header('HTTP/1.1 400 Bad Request: '.$title, true, 400); |
|
377 | 377 | } |
378 | 378 | |
379 | 379 | self::displayXML(self::buildErrorXML($code, $message, $title, $customInfo)); |
380 | 380 | } |
381 | 381 | |
382 | - public static function setSimulation(bool $simulate=true) : void |
|
382 | + public static function setSimulation(bool $simulate = true) : void |
|
383 | 383 | { |
384 | 384 | self::$simulation = $simulate; |
385 | 385 | } |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | * @param array<string,string> $customInfo |
429 | 429 | * @return string |
430 | 430 | */ |
431 | - public static function buildErrorXML($code, string $message, string $title, array $customInfo=array()) |
|
431 | + public static function buildErrorXML($code, string $message, string $title, array $customInfo = array()) |
|
432 | 432 | { |
433 | 433 | $xml = new DOMDocument('1.0', 'UTF-8'); |
434 | 434 | $xml->formatOutput = true; |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | $helper->addTextTag($root, 'title', $title); |
443 | 443 | $helper->addTextTag($root, 'request_uri', $_SERVER['REQUEST_URI']); |
444 | 444 | |
445 | - foreach($customInfo as $name => $value) { |
|
445 | + foreach ($customInfo as $name => $value) { |
|
446 | 446 | $helper->addTextTag($root, $name, $value); |
447 | 447 | } |
448 | 448 |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public static function json($subject) : string |
110 | 110 | { |
111 | - if(!is_string($subject)) |
|
111 | + if (!is_string($subject)) |
|
112 | 112 | { |
113 | 113 | $subject = json_encode($subject, JSON_PRETTY_PRINT); |
114 | 114 | } |
@@ -125,9 +125,9 @@ discard block |
||
125 | 125 | * @param bool $formatSource Whether to format the source with indentation to make it readable. |
126 | 126 | * @return string |
127 | 127 | */ |
128 | - public static function xml(string $xml, bool $formatSource=false) : string |
|
128 | + public static function xml(string $xml, bool $formatSource = false) : string |
|
129 | 129 | { |
130 | - if($formatSource) |
|
130 | + if ($formatSource) |
|
131 | 131 | { |
132 | 132 | $dom = new DOMDocument(); |
133 | 133 | $dom->preserveWhiteSpace = false; |
@@ -148,9 +148,9 @@ discard block |
||
148 | 148 | * @param bool $formatSource |
149 | 149 | * @return string |
150 | 150 | */ |
151 | - public static function html(string $html, bool $formatSource=false) : string |
|
151 | + public static function html(string $html, bool $formatSource = false) : string |
|
152 | 152 | { |
153 | - if($formatSource) |
|
153 | + if ($formatSource) |
|
154 | 154 | { |
155 | 155 | $dom = new DOMDocument(); |
156 | 156 | $dom->preserveWhiteSpace = false; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | */ |
49 | 49 | private function initUnits() : void |
50 | 50 | { |
51 | - if(isset(self::$units)) |
|
51 | + if (isset(self::$units)) |
|
52 | 52 | { |
53 | 53 | return; |
54 | 54 | } |
@@ -90,12 +90,12 @@ discard block |
||
90 | 90 | public function toString() : string |
91 | 91 | { |
92 | 92 | // specifically handle zero |
93 | - if($this->seconds <= 0) |
|
93 | + if ($this->seconds <= 0) |
|
94 | 94 | { |
95 | - return '0 ' . t('seconds'); |
|
95 | + return '0 '.t('seconds'); |
|
96 | 96 | } |
97 | 97 | |
98 | - if($this->seconds < 1) |
|
98 | + if ($this->seconds < 1) |
|
99 | 99 | { |
100 | 100 | return t('less than a second'); |
101 | 101 | } |
@@ -104,12 +104,12 @@ discard block |
||
104 | 104 | |
105 | 105 | $last = array_pop($tokens); |
106 | 106 | |
107 | - if(empty($tokens)) |
|
107 | + if (empty($tokens)) |
|
108 | 108 | { |
109 | 109 | return $last; |
110 | 110 | } |
111 | 111 | |
112 | - return implode(', ', $tokens) . ' ' . t('and') . ' ' . $last; |
|
112 | + return implode(', ', $tokens).' '.t('and').' '.$last; |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | /** |
@@ -122,18 +122,18 @@ discard block |
||
122 | 122 | $seconds = $this->seconds; |
123 | 123 | $tokens = array(); |
124 | 124 | |
125 | - foreach(self::$units as $def) |
|
125 | + foreach (self::$units as $def) |
|
126 | 126 | { |
127 | 127 | $unitValue = intval($seconds / $def['value']); |
128 | 128 | |
129 | - if($unitValue <= 0) |
|
129 | + if ($unitValue <= 0) |
|
130 | 130 | { |
131 | 131 | continue; |
132 | 132 | } |
133 | 133 | |
134 | - $item = strval($unitValue) . ' '; |
|
134 | + $item = strval($unitValue).' '; |
|
135 | 135 | |
136 | - if(abs($unitValue) > 1) |
|
136 | + if (abs($unitValue) > 1) |
|
137 | 137 | { |
138 | 138 | $item .= $def['plural']; |
139 | 139 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | 'fragment' |
78 | 78 | ); |
79 | 79 | |
80 | - foreach($parts as $part) |
|
80 | + foreach ($parts as $part) |
|
81 | 81 | { |
82 | 82 | $method = 'render_'.$part; |
83 | 83 | $result[] = (string)$this->$method(); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | |
89 | 89 | protected function render_scheme() : string |
90 | 90 | { |
91 | - if(!$this->info->hasScheme()) { |
|
91 | + if (!$this->info->hasScheme()) { |
|
92 | 92 | return ''; |
93 | 93 | } |
94 | 94 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | |
104 | 104 | protected function render_username() : string |
105 | 105 | { |
106 | - if(!$this->info->hasUsername()) { |
|
106 | + if (!$this->info->hasUsername()) { |
|
107 | 107 | return ''; |
108 | 108 | } |
109 | 109 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | |
120 | 120 | protected function render_host() : string |
121 | 121 | { |
122 | - if(!$this->info->hasHost()) { |
|
122 | + if (!$this->info->hasHost()) { |
|
123 | 123 | return ''; |
124 | 124 | } |
125 | 125 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | |
132 | 132 | protected function render_port() : string |
133 | 133 | { |
134 | - if(!$this->info->hasPort()) { |
|
134 | + if (!$this->info->hasPort()) { |
|
135 | 135 | return ''; |
136 | 136 | } |
137 | 137 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | |
145 | 145 | protected function render_path() : string |
146 | 146 | { |
147 | - if(!$this->info->hasPath()) { |
|
147 | + if (!$this->info->hasPath()) { |
|
148 | 148 | return ''; |
149 | 149 | } |
150 | 150 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | { |
170 | 170 | $previous = $this->info->isParamExclusionEnabled(); |
171 | 171 | |
172 | - if($previous) |
|
172 | + if ($previous) |
|
173 | 173 | { |
174 | 174 | $this->info->setParamExclusion(false); |
175 | 175 | } |
@@ -185,19 +185,19 @@ discard block |
||
185 | 185 | { |
186 | 186 | $params = $this->resolveParams(); |
187 | 187 | |
188 | - if(empty($params)) { |
|
188 | + if (empty($params)) { |
|
189 | 189 | return ''; |
190 | 190 | } |
191 | 191 | |
192 | 192 | $tokens = array(); |
193 | 193 | $excluded = array(); |
194 | 194 | |
195 | - if($this->info->isParamExclusionEnabled()) |
|
195 | + if ($this->info->isParamExclusionEnabled()) |
|
196 | 196 | { |
197 | 197 | $excluded = $this->info->getExcludedParams(); |
198 | 198 | } |
199 | 199 | |
200 | - foreach($params as $param => $value) |
|
200 | + foreach ($params as $param => $value) |
|
201 | 201 | { |
202 | 202 | // If the parameter is numeric, it will automatically |
203 | 203 | // be an integer, so we need the conversion here. |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | |
219 | 219 | $tag = $this->resolveTag($excluded, $param); |
220 | 220 | |
221 | - if(!empty($tag)) |
|
221 | + if (!empty($tag)) |
|
222 | 222 | { |
223 | 223 | $tokens[] = sprintf($tag, $parts); |
224 | 224 | } |
@@ -232,13 +232,13 @@ discard block |
||
232 | 232 | protected function resolveTag(array $excluded, string $paramName) : string |
233 | 233 | { |
234 | 234 | // regular, non-excluded parameter |
235 | - if(!isset($excluded[$paramName])) |
|
235 | + if (!isset($excluded[$paramName])) |
|
236 | 236 | { |
237 | 237 | return '<span class="link-param">%s</span>'; |
238 | 238 | } |
239 | 239 | |
240 | 240 | // highlight excluded parameters is disabled, ignore this parameter |
241 | - if(!$this->info->isHighlightExcludeEnabled()) |
|
241 | + if (!$this->info->isHighlightExcludeEnabled()) |
|
242 | 242 | { |
243 | 243 | return ''; |
244 | 244 | } |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | |
255 | 255 | protected function render_fragment() : string |
256 | 256 | { |
257 | - if(!$this->info->hasFragment()) { |
|
257 | + if (!$this->info->hasFragment()) { |
|
258 | 258 | return ''; |
259 | 259 | } |
260 | 260 | |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | { |
270 | 270 | $cssFolder = realpath(__DIR__.'/../../css'); |
271 | 271 | |
272 | - if($cssFolder === false) { |
|
272 | + if ($cssFolder === false) { |
|
273 | 273 | throw new BaseException( |
274 | 274 | 'Cannot find package CSS folder.', |
275 | 275 | null, |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | |
171 | 171 | public function isHeadersPosition($position) |
172 | 172 | { |
173 | - if($this->headersPosition === $position) { |
|
173 | + if ($this->headersPosition === $position) { |
|
174 | 174 | return true; |
175 | 175 | } |
176 | 176 | |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | self::HEADERS_TOP |
198 | 198 | ); |
199 | 199 | |
200 | - if(!in_array($position, $validPositions)) { |
|
200 | + if (!in_array($position, $validPositions)) { |
|
201 | 201 | throw new CSVHelper_Exception( |
202 | 202 | 'Invalid headers position', |
203 | 203 | sprintf( |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | */ |
254 | 254 | public function getRow($index) |
255 | 255 | { |
256 | - if(isset($this->data[$index])) { |
|
256 | + if (isset($this->data[$index])) { |
|
257 | 257 | return $this->data[$index]; |
258 | 258 | } |
259 | 259 | |
@@ -320,9 +320,9 @@ discard block |
||
320 | 320 | public function getColumn($index) |
321 | 321 | { |
322 | 322 | $data = array(); |
323 | - for($i=0; $i < $this->rowCount; $i++) { |
|
323 | + for ($i = 0; $i < $this->rowCount; $i++) { |
|
324 | 324 | $value = ''; |
325 | - if(isset($this->data[$i][$index])) { |
|
325 | + if (isset($this->data[$i][$index])) { |
|
326 | 326 | $value = $this->data[$i][$index]; |
327 | 327 | } |
328 | 328 | |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | */ |
340 | 340 | public function columnExists($index) |
341 | 341 | { |
342 | - if($index < $this->columnCount) { |
|
342 | + if ($index < $this->columnCount) { |
|
343 | 343 | return true; |
344 | 344 | } |
345 | 345 | |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | { |
351 | 351 | $this->reset(); |
352 | 352 | |
353 | - if(empty(trim($this->csv))) { |
|
353 | + if (empty(trim($this->csv))) { |
|
354 | 354 | $this->addError('Tried to parse an empty CSV string.'); |
355 | 355 | return; |
356 | 356 | } |
@@ -362,14 +362,14 @@ discard block |
||
362 | 362 | |
363 | 363 | $parser = self::createParser(); |
364 | 364 | |
365 | - if(!$parser->parse($this->csv)) { |
|
365 | + if (!$parser->parse($this->csv)) { |
|
366 | 366 | $this->addError('The CSV string could not be parsed.'); |
367 | 367 | return; |
368 | 368 | } |
369 | 369 | |
370 | 370 | $result = $parser->data; |
371 | 371 | |
372 | - switch($this->headersPosition) |
|
372 | + switch ($this->headersPosition) |
|
373 | 373 | { |
374 | 374 | case self::HEADERS_TOP: |
375 | 375 | $this->headers = array_shift($result); |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | case self::HEADERS_LEFT: |
379 | 379 | $keep = array(); |
380 | 380 | $total = count($result); |
381 | - for($i=0; $i < $total; $i++) { |
|
381 | + for ($i = 0; $i < $total; $i++) { |
|
382 | 382 | $row = $result[$i]; |
383 | 383 | $this->headers[] = array_shift($row); |
384 | 384 | $keep[] = $row; |
@@ -391,9 +391,9 @@ discard block |
||
391 | 391 | $this->data = $result; |
392 | 392 | $this->rowCount = count($this->data); |
393 | 393 | |
394 | - for($i=0; $i < $this->rowCount; $i++) { |
|
394 | + for ($i = 0; $i < $this->rowCount; $i++) { |
|
395 | 395 | $amount = count($this->data[$i]); |
396 | - if($amount > $this->columnCount) { |
|
396 | + if ($amount > $this->columnCount) { |
|
397 | 397 | $this->columnCount = $amount; |
398 | 398 | } |
399 | 399 | } |
@@ -437,8 +437,8 @@ discard block |
||
437 | 437 | ',,' => ',' |
438 | 438 | ); |
439 | 439 | |
440 | - foreach($search as $char => $separator) { |
|
441 | - if(strstr($this->csv, $char)) { |
|
440 | + foreach ($search as $char => $separator) { |
|
441 | + if (strstr($this->csv, $char)) { |
|
442 | 442 | return $separator; |
443 | 443 | } |
444 | 444 | } |
@@ -452,11 +452,11 @@ discard block |
||
452 | 452 | * @param string $delimiter |
453 | 453 | * @return Csv |
454 | 454 | */ |
455 | - public static function createParser(string $delimiter=self::DELIMITER_AUTO) : Csv |
|
455 | + public static function createParser(string $delimiter = self::DELIMITER_AUTO) : Csv |
|
456 | 456 | { |
457 | 457 | $csv = new Csv(); |
458 | 458 | |
459 | - if($delimiter !== self::DELIMITER_AUTO) { |
|
459 | + if ($delimiter !== self::DELIMITER_AUTO) { |
|
460 | 460 | $csv->delimiter = $delimiter; |
461 | 461 | } |
462 | 462 | |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | $parser = self::createParser(); |
483 | 483 | $result = $parser->parse($path); |
484 | 484 | |
485 | - if($result === true) { |
|
485 | + if ($result === true) { |
|
486 | 486 | return $parser->data; |
487 | 487 | } |
488 | 488 | |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | $parser = self::createParser(); |
513 | 513 | $result = $parser->parse($string); |
514 | 514 | |
515 | - if($result === true) { |
|
515 | + if ($result === true) { |
|
516 | 516 | return $parser->data; |
517 | 517 | } |
518 | 518 |
@@ -15,7 +15,7 @@ |
||
15 | 15 | $autoload = $root.'/vendor/autoload.php'; |
16 | 16 | |
17 | 17 | // we need the autoloader to be present |
18 | - if($autoload === false) |
|
18 | + if ($autoload === false) |
|
19 | 19 | { |
20 | 20 | die('<b>ERROR:</b> Autoloader not present. Run composer update first.'); |
21 | 21 | } |
@@ -29,17 +29,17 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public static function fromString($string) : bool |
31 | 31 | { |
32 | - if($string === '' || $string === null || !is_scalar($string)) |
|
32 | + if ($string === '' || $string === null || !is_scalar($string)) |
|
33 | 33 | { |
34 | 34 | return false; |
35 | 35 | } |
36 | 36 | |
37 | - if(is_bool($string)) |
|
37 | + if (is_bool($string)) |
|
38 | 38 | { |
39 | 39 | return $string; |
40 | 40 | } |
41 | 41 | |
42 | - if(array_key_exists($string, self::$booleanStrings)) |
|
42 | + if (array_key_exists($string, self::$booleanStrings)) |
|
43 | 43 | { |
44 | 44 | return self::$booleanStrings[$string]; |
45 | 45 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | public static function toString($boolean, bool $yesno = false) : string |
68 | 68 | { |
69 | 69 | // allow 'yes', 'true', 'no', 'false' string notations as well |
70 | - if(!is_bool($boolean)) { |
|
70 | + if (!is_bool($boolean)) { |
|
71 | 71 | $boolean = self::fromString($boolean); |
72 | 72 | } |
73 | 73 | |
@@ -97,11 +97,11 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public static function isBoolean($value) : bool |
99 | 99 | { |
100 | - if(is_bool($value)) { |
|
100 | + if (is_bool($value)) { |
|
101 | 101 | return true; |
102 | 102 | } |
103 | 103 | |
104 | - if(!is_scalar($value)) { |
|
104 | + if (!is_scalar($value)) { |
|
105 | 105 | return false; |
106 | 106 | } |
107 | 107 |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * @param string[] $paths |
33 | 33 | * @throws FileHelper_Exception |
34 | 34 | */ |
35 | - public function __construct(array $paths=array()) |
|
35 | + public function __construct(array $paths = array()) |
|
36 | 36 | { |
37 | 37 | $this->addPaths($paths); |
38 | 38 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function addPaths(array $paths) : FileHelper_PathsReducer |
48 | 48 | { |
49 | - foreach($paths as $path) { |
|
49 | + foreach ($paths as $path) { |
|
50 | 50 | $this->addPath($path); |
51 | 51 | } |
52 | 52 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | { |
65 | 65 | $path = FileHelper::normalizePath(FileHelper::requireFileExists($path)); |
66 | 66 | |
67 | - if(!in_array($path, $this->paths)) { |
|
67 | + if (!in_array($path, $this->paths)) { |
|
68 | 68 | $this->paths[] = $path; |
69 | 69 | } |
70 | 70 | |
@@ -81,11 +81,11 @@ discard block |
||
81 | 81 | { |
82 | 82 | $split = $this->splitPaths(); |
83 | 83 | |
84 | - if(empty($split)) { |
|
84 | + if (empty($split)) { |
|
85 | 85 | return array(); |
86 | 86 | } |
87 | 87 | |
88 | - while($this->shiftPart($split) === true) {} |
|
88 | + while ($this->shiftPart($split) === true) {} |
|
89 | 89 | |
90 | 90 | return $this->joinPaths($split); |
91 | 91 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $result = array(); |
100 | 100 | |
101 | 101 | foreach ($split as $entry) { |
102 | - if(!empty($entry)) { |
|
102 | + if (!empty($entry)) { |
|
103 | 103 | $result[] = implode('/', $entry); |
104 | 104 | } |
105 | 105 | } |
@@ -116,22 +116,22 @@ discard block |
||
116 | 116 | $current = null; |
117 | 117 | $result = array(); |
118 | 118 | |
119 | - foreach($split as $entry) |
|
119 | + foreach ($split as $entry) |
|
120 | 120 | { |
121 | - if(empty($entry)) { |
|
121 | + if (empty($entry)) { |
|
122 | 122 | return false; |
123 | 123 | } |
124 | 124 | |
125 | 125 | $part = array_shift($entry); |
126 | - if(empty($entry)) { |
|
126 | + if (empty($entry)) { |
|
127 | 127 | return false; |
128 | 128 | } |
129 | 129 | |
130 | - if($current === null) { |
|
130 | + if ($current === null) { |
|
131 | 131 | $current = $part; |
132 | 132 | } |
133 | 133 | |
134 | - if($part !== $current) { |
|
134 | + if ($part !== $current) { |
|
135 | 135 | return false; |
136 | 136 | } |
137 | 137 | |
@@ -147,9 +147,9 @@ discard block |
||
147 | 147 | { |
148 | 148 | $split = array(); |
149 | 149 | |
150 | - foreach($this->paths as $path) { |
|
150 | + foreach ($this->paths as $path) { |
|
151 | 151 | $entry = ConvertHelper::explodeTrim('/', $path); |
152 | - if(!empty($entry)) { |
|
152 | + if (!empty($entry)) { |
|
153 | 153 | $split[] = $entry; |
154 | 154 | } |
155 | 155 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public static function detect(string $subjectString) : ?ConvertHelper_EOL |
123 | 123 | { |
124 | - if(empty($subjectString)) { |
|
124 | + if (empty($subjectString)) { |
|
125 | 125 | return null; |
126 | 126 | } |
127 | 127 | |
@@ -129,18 +129,18 @@ discard block |
||
129 | 129 | $results = array(); |
130 | 130 | $chars = self::getEOLChars(); |
131 | 131 | |
132 | - foreach($chars as $def) |
|
132 | + foreach ($chars as $def) |
|
133 | 133 | { |
134 | 134 | $amount = substr_count($subjectString, $def['char']); |
135 | 135 | |
136 | - if($amount > $max) |
|
136 | + if ($amount > $max) |
|
137 | 137 | { |
138 | 138 | $max = $amount; |
139 | 139 | $results[] = $def; |
140 | 140 | } |
141 | 141 | } |
142 | 142 | |
143 | - if(empty($results)) { |
|
143 | + if (empty($results)) { |
|
144 | 144 | return null; |
145 | 145 | } |
146 | 146 | |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | */ |
157 | 157 | public static function getEOLChars() : array |
158 | 158 | { |
159 | - if(isset(self::$eolChars)) { |
|
159 | + if (isset(self::$eolChars)) { |
|
160 | 160 | return self::$eolChars; |
161 | 161 | } |
162 | 162 |