@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | |
| 242 | 242 | $output = curl_exec($ch); |
| 243 | 243 | |
| 244 | - if(isset($this->logfilePointer)) |
|
| 244 | + if (isset($this->logfilePointer)) |
|
| 245 | 245 | { |
| 246 | 246 | fclose($this->logfilePointer); |
| 247 | 247 | } |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | // CURL will complain about an empty response when the |
| 254 | 254 | // server sends a 100-continue code. That should not be |
| 255 | 255 | // regarded as an error. |
| 256 | - if($output === false && $this->response->getCode() !== 100) |
|
| 256 | + if ($output === false && $this->response->getCode() !== 100) |
|
| 257 | 257 | { |
| 258 | 258 | $curlCode = curl_errno($ch); |
| 259 | 259 | |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | { |
| 290 | 290 | $ch = curl_init(); |
| 291 | 291 | |
| 292 | - if(!is_resource($ch)) |
|
| 292 | + if (!is_resource($ch)) |
|
| 293 | 293 | { |
| 294 | 294 | throw new RequestHelper_Exception( |
| 295 | 295 | 'Could not initialize a new cURL instance.', |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | $this->setHeader('Content-Length', (string)$this->boundaries->getContentLength()); |
| 302 | - $this->setHeader('Content-Type', 'multipart/form-data; boundary=' . $this->mimeBoundary); |
|
| 302 | + $this->setHeader('Content-Type', 'multipart/form-data; boundary='.$this->mimeBoundary); |
|
| 303 | 303 | |
| 304 | 304 | curl_setopt($ch, CURLOPT_POST, true); |
| 305 | 305 | curl_setopt($ch, CURLOPT_URL, $url->getNormalizedWithoutAuth()); |
@@ -312,18 +312,18 @@ discard block |
||
| 312 | 312 | |
| 313 | 313 | $loggingEnabled = $this->configureLogging($ch); |
| 314 | 314 | |
| 315 | - if(!$loggingEnabled) |
|
| 315 | + if (!$loggingEnabled) |
|
| 316 | 316 | { |
| 317 | 317 | curl_setopt($ch, CURLINFO_HEADER_OUT, true); |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | - if($this->verifySSL) |
|
| 320 | + if ($this->verifySSL) |
|
| 321 | 321 | { |
| 322 | 322 | curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); |
| 323 | 323 | curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); |
| 324 | 324 | } |
| 325 | 325 | |
| 326 | - if($url->hasUsername()) |
|
| 326 | + if ($url->hasUsername()) |
|
| 327 | 327 | { |
| 328 | 328 | curl_setopt($ch, CURLOPT_USERNAME, $url->getUsername()); |
| 329 | 329 | curl_setopt($ch, CURLOPT_PASSWORD, $url->getPassword()); |
@@ -338,14 +338,14 @@ discard block |
||
| 338 | 338 | */ |
| 339 | 339 | protected function configureLogging($ch) : bool |
| 340 | 340 | { |
| 341 | - if(empty($this->logfile)) |
|
| 341 | + if (empty($this->logfile)) |
|
| 342 | 342 | { |
| 343 | 343 | return false; |
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | $res = fopen($this->logfile, 'w+'); |
| 347 | 347 | |
| 348 | - if($res === false) |
|
| 348 | + if ($res === false) |
|
| 349 | 349 | { |
| 350 | 350 | throw new RequestHelper_Exception( |
| 351 | 351 | 'Cannot open logfile for writing.', |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | |
| 376 | 376 | $this->setHeader('Expect', ''); |
| 377 | 377 | |
| 378 | - foreach($this->headers as $name => $value) { |
|
| 378 | + foreach ($this->headers as $name => $value) { |
|
| 379 | 379 | $result[] = $name.': '.$value; |
| 380 | 380 | } |
| 381 | 381 | |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | { |
| 393 | 393 | $response = $this->getResponse(); |
| 394 | 394 | |
| 395 | - if($response !== null) { |
|
| 395 | + if ($response !== null) { |
|
| 396 | 396 | return $response->getHeaders(); |
| 397 | 397 | } |
| 398 | 398 | |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | */ |
| 429 | 429 | public function getHeader(string $name) : string |
| 430 | 430 | { |
| 431 | - if(isset($this->headers[$name])) |
|
| 431 | + if (isset($this->headers[$name])) |
|
| 432 | 432 | { |
| 433 | 433 | return $this->headers[$name]; |
| 434 | 434 | } |
@@ -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,7 +29,7 @@ |
||
| 29 | 29 | |
| 30 | 30 | // In the case of tel URLs, we convert the syntax to use double |
| 31 | 31 | // slashes to make them parsable. |
| 32 | - if(strstr($url, 'tel:') !== false && strstr($url, 'tel://') === false) { |
|
| 32 | + if (strstr($url, 'tel:') !== false && strstr($url, 'tel://') === false) { |
|
| 33 | 33 | $url = str_replace('tel:', 'tel://', $url); |
| 34 | 34 | } |
| 35 | 35 | |
@@ -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 | |