@@ -56,12 +56,12 @@ discard block |
||
| 56 | 56 | $this->init(); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - /** |
|
| 60 | - * Can be extended in a subclass, to avoid |
|
| 61 | - * redefining the constructor. |
|
| 62 | - * |
|
| 63 | - * @return void |
|
| 64 | - */ |
|
| 59 | + /** |
|
| 60 | + * Can be extended in a subclass, to avoid |
|
| 61 | + * redefining the constructor. |
|
| 62 | + * |
|
| 63 | + * @return void |
|
| 64 | + */ |
|
| 65 | 65 | protected function init() : void |
| 66 | 66 | { |
| 67 | 67 | |
@@ -126,30 +126,30 @@ discard block |
||
| 126 | 126 | return $this->buildURL($params, $dispatcher); |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - /** |
|
| 130 | - * Retrieves the name of the current dispatcher script / page. |
|
| 131 | - * This is made to be extended and implemented in a subclass. |
|
| 132 | - * |
|
| 133 | - * @return string |
|
| 134 | - */ |
|
| 129 | + /** |
|
| 130 | + * Retrieves the name of the current dispatcher script / page. |
|
| 131 | + * This is made to be extended and implemented in a subclass. |
|
| 132 | + * |
|
| 133 | + * @return string |
|
| 134 | + */ |
|
| 135 | 135 | public function getDispatcher() : string |
| 136 | 136 | { |
| 137 | 137 | return ''; |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | - /** |
|
| 141 | - * Filters and retrieves the current request variables |
|
| 142 | - * to be used to build a URL to refresh the current page. |
|
| 143 | - * |
|
| 144 | - * For further customization options, use the |
|
| 145 | - * {@see Request::createRefreshParams()} method. |
|
| 146 | - * |
|
| 147 | - * @param array<string,mixed> $params Key => value pairs of parameters to always include in the result. |
|
| 148 | - * @param string[] $exclude Names of parameters to exclude from the result. |
|
| 149 | - * @return array<string,mixed> |
|
| 150 | - * |
|
| 151 | - * @see Request::createRefreshParams() |
|
| 152 | - */ |
|
| 140 | + /** |
|
| 141 | + * Filters and retrieves the current request variables |
|
| 142 | + * to be used to build a URL to refresh the current page. |
|
| 143 | + * |
|
| 144 | + * For further customization options, use the |
|
| 145 | + * {@see Request::createRefreshParams()} method. |
|
| 146 | + * |
|
| 147 | + * @param array<string,mixed> $params Key => value pairs of parameters to always include in the result. |
|
| 148 | + * @param string[] $exclude Names of parameters to exclude from the result. |
|
| 149 | + * @return array<string,mixed> |
|
| 150 | + * |
|
| 151 | + * @see Request::createRefreshParams() |
|
| 152 | + */ |
|
| 153 | 153 | public function getRefreshParams(array $params = array(), array $exclude = array()) : array |
| 154 | 154 | { |
| 155 | 155 | return $this->createRefreshParams() |
@@ -158,13 +158,13 @@ discard block |
||
| 158 | 158 | ->getParams(); |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - /** |
|
| 162 | - * Creates an instance of the helper that can be used to |
|
| 163 | - * retrieve the request's parameters collection, with the |
|
| 164 | - * possibility to exclude and override some by rules. |
|
| 165 | - * |
|
| 166 | - * @return Request_RefreshParams |
|
| 167 | - */ |
|
| 161 | + /** |
|
| 162 | + * Creates an instance of the helper that can be used to |
|
| 163 | + * retrieve the request's parameters collection, with the |
|
| 164 | + * possibility to exclude and override some by rules. |
|
| 165 | + * |
|
| 166 | + * @return Request_RefreshParams |
|
| 167 | + */ |
|
| 168 | 168 | public function createRefreshParams() : Request_RefreshParams |
| 169 | 169 | { |
| 170 | 170 | return new Request_RefreshParams(); |
@@ -200,10 +200,10 @@ discard block |
||
| 200 | 200 | return $url; |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | - /** |
|
| 204 | - * Retrieves the base URL of the application. |
|
| 205 | - * @return string |
|
| 206 | - */ |
|
| 203 | + /** |
|
| 204 | + * Retrieves the base URL of the application. |
|
| 205 | + * @return string |
|
| 206 | + */ |
|
| 207 | 207 | public function getBaseURL() : string |
| 208 | 208 | { |
| 209 | 209 | return $this->baseURL; |
@@ -233,13 +233,13 @@ discard block |
||
| 233 | 233 | return $this->knownParams[$name]; |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | - /** |
|
| 237 | - * Retrieves a previously registered parameter instance. |
|
| 238 | - * |
|
| 239 | - * @param string $name |
|
| 240 | - * @return RequestParam |
|
| 241 | - *@throws Request_Exception |
|
| 242 | - */ |
|
| 236 | + /** |
|
| 237 | + * Retrieves a previously registered parameter instance. |
|
| 238 | + * |
|
| 239 | + * @param string $name |
|
| 240 | + * @return RequestParam |
|
| 241 | + *@throws Request_Exception |
|
| 242 | + */ |
|
| 243 | 243 | public function getRegisteredParam(string $name) : RequestParam |
| 244 | 244 | { |
| 245 | 245 | if(isset($this->knownParams[$name])) { |
@@ -256,48 +256,48 @@ discard block |
||
| 256 | 256 | ); |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | - /** |
|
| 260 | - * Checks whether a parameter with the specified name |
|
| 261 | - * has been registered. |
|
| 262 | - * |
|
| 263 | - * @param string $name |
|
| 264 | - * @return bool |
|
| 265 | - */ |
|
| 259 | + /** |
|
| 260 | + * Checks whether a parameter with the specified name |
|
| 261 | + * has been registered. |
|
| 262 | + * |
|
| 263 | + * @param string $name |
|
| 264 | + * @return bool |
|
| 265 | + */ |
|
| 266 | 266 | public function hasRegisteredParam(string $name) : bool |
| 267 | 267 | { |
| 268 | 268 | return isset($this->knownParams[$name]); |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | - /** |
|
| 272 | - * Retrieves an indexed array with accept mime types |
|
| 273 | - * that the client sent, in the order of preference |
|
| 274 | - * the client specified. |
|
| 275 | - * |
|
| 276 | - * Example: |
|
| 277 | - * |
|
| 278 | - * array( |
|
| 279 | - * 'text/html', |
|
| 280 | - * 'application/xhtml+xml', |
|
| 281 | - * 'image/webp' |
|
| 282 | - * ... |
|
| 283 | - * ) |
|
| 284 | - * |
|
| 285 | - * @return string[] |
|
| 286 | - * @see Request::parseAcceptHeaders() |
|
| 287 | - */ |
|
| 271 | + /** |
|
| 272 | + * Retrieves an indexed array with accept mime types |
|
| 273 | + * that the client sent, in the order of preference |
|
| 274 | + * the client specified. |
|
| 275 | + * |
|
| 276 | + * Example: |
|
| 277 | + * |
|
| 278 | + * array( |
|
| 279 | + * 'text/html', |
|
| 280 | + * 'application/xhtml+xml', |
|
| 281 | + * 'image/webp' |
|
| 282 | + * ... |
|
| 283 | + * ) |
|
| 284 | + * |
|
| 285 | + * @return string[] |
|
| 286 | + * @see Request::parseAcceptHeaders() |
|
| 287 | + */ |
|
| 288 | 288 | public static function getAcceptHeaders() : array |
| 289 | 289 | { |
| 290 | 290 | return self::parseAcceptHeaders()->getMimeStrings(); |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | - /** |
|
| 294 | - * Returns an instance of the "accept" headers parser, |
|
| 295 | - * to access information on the browser's accepted |
|
| 296 | - * mime types. |
|
| 297 | - * |
|
| 298 | - * @return Request_AcceptHeaders |
|
| 299 | - * @see Request::getAcceptHeaders() |
|
| 300 | - */ |
|
| 293 | + /** |
|
| 294 | + * Returns an instance of the "accept" headers parser, |
|
| 295 | + * to access information on the browser's accepted |
|
| 296 | + * mime types. |
|
| 297 | + * |
|
| 298 | + * @return Request_AcceptHeaders |
|
| 299 | + * @see Request::getAcceptHeaders() |
|
| 300 | + */ |
|
| 301 | 301 | public static function parseAcceptHeaders() : Request_AcceptHeaders |
| 302 | 302 | { |
| 303 | 303 | static $accept; |
@@ -341,14 +341,14 @@ discard block |
||
| 341 | 341 | return $this->getParam($name) !== null; |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | - /** |
|
| 345 | - * Removes a single parameter from the request. |
|
| 346 | - * If the parameter has been registered, also |
|
| 347 | - * removes the registration info. |
|
| 348 | - * |
|
| 349 | - * @param string $name |
|
| 350 | - * @return Request |
|
| 351 | - */ |
|
| 344 | + /** |
|
| 345 | + * Removes a single parameter from the request. |
|
| 346 | + * If the parameter has been registered, also |
|
| 347 | + * removes the registration info. |
|
| 348 | + * |
|
| 349 | + * @param string $name |
|
| 350 | + * @return Request |
|
| 351 | + */ |
|
| 352 | 352 | public function removeParam(string $name) : Request |
| 353 | 353 | { |
| 354 | 354 | if(isset($_REQUEST[$name])) { |
@@ -362,12 +362,12 @@ discard block |
||
| 362 | 362 | return $this; |
| 363 | 363 | } |
| 364 | 364 | |
| 365 | - /** |
|
| 366 | - * Removes several parameters from the request. |
|
| 367 | - * |
|
| 368 | - * @param string[] $names |
|
| 369 | - * @return Request |
|
| 370 | - */ |
|
| 365 | + /** |
|
| 366 | + * Removes several parameters from the request. |
|
| 367 | + * |
|
| 368 | + * @param string[] $names |
|
| 369 | + * @return Request |
|
| 370 | + */ |
|
| 371 | 371 | public function removeParams(array $names) : Request |
| 372 | 372 | { |
| 373 | 373 | foreach($names as $name) { |
@@ -563,11 +563,11 @@ discard block |
||
| 563 | 563 | exit; |
| 564 | 564 | } |
| 565 | 565 | |
| 566 | - /** |
|
| 567 | - * Sends HTML to the browser with the correct headers. |
|
| 568 | - * |
|
| 569 | - * @param string $html |
|
| 570 | - */ |
|
| 566 | + /** |
|
| 567 | + * Sends HTML to the browser with the correct headers. |
|
| 568 | + * |
|
| 569 | + * @param string $html |
|
| 570 | + */ |
|
| 571 | 571 | public static function sendHTML(string $html) : void |
| 572 | 572 | { |
| 573 | 573 | header('Cache-Control: no-cache, must-revalidate'); |
@@ -588,16 +588,16 @@ discard block |
||
| 588 | 588 | exit; |
| 589 | 589 | } |
| 590 | 590 | |
| 591 | - /** |
|
| 592 | - * Creates a new instance of the URL comparer, which can check |
|
| 593 | - * whether the specified URLs match, regardless of the order in |
|
| 594 | - * which the query parameters are, if any. |
|
| 595 | - * |
|
| 596 | - * @param string $sourceURL |
|
| 597 | - * @param string $targetURL |
|
| 598 | - * @param string[] $limitParams Whether to limit the comparison to these specific parameter names (if present) |
|
| 599 | - * @return Request_URLComparer |
|
| 600 | - */ |
|
| 591 | + /** |
|
| 592 | + * Creates a new instance of the URL comparer, which can check |
|
| 593 | + * whether the specified URLs match, regardless of the order in |
|
| 594 | + * which the query parameters are, if any. |
|
| 595 | + * |
|
| 596 | + * @param string $sourceURL |
|
| 597 | + * @param string $targetURL |
|
| 598 | + * @param string[] $limitParams Whether to limit the comparison to these specific parameter names (if present) |
|
| 599 | + * @return Request_URLComparer |
|
| 600 | + */ |
|
| 601 | 601 | public function createURLComparer(string $sourceURL, string $targetURL, array $limitParams=array()) : Request_URLComparer |
| 602 | 602 | { |
| 603 | 603 | $comparer = new Request_URLComparer($this, $sourceURL, $targetURL); |
@@ -606,10 +606,10 @@ discard block |
||
| 606 | 606 | return $comparer; |
| 607 | 607 | } |
| 608 | 608 | |
| 609 | - /** |
|
| 610 | - * Retrieves the full URL that was used to access the current page. |
|
| 611 | - * @return string |
|
| 612 | - */ |
|
| 609 | + /** |
|
| 610 | + * Retrieves the full URL that was used to access the current page. |
|
| 611 | + * @return string |
|
| 612 | + */ |
|
| 613 | 613 | public function getCurrentURL() : string |
| 614 | 614 | { |
| 615 | 615 | return $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | { |
| 92 | 92 | $value = $_REQUEST[$name] ?? $default; |
| 93 | 93 | |
| 94 | - if(isset($this->knownParams[$name])) { |
|
| 94 | + if (isset($this->knownParams[$name])) { |
|
| 95 | 95 | $value = $this->knownParams[$name]->validate($value); |
| 96 | 96 | } |
| 97 | 97 | |
@@ -188,13 +188,13 @@ discard block |
||
| 188 | 188 | * @param string $dispatcher Relative path to script to use for the URL. Append trailing slash if needed. |
| 189 | 189 | * @return string |
| 190 | 190 | */ |
| 191 | - public function buildURL(array $params = array(), string $dispatcher='') : string |
|
| 191 | + public function buildURL(array $params = array(), string $dispatcher = '') : string |
|
| 192 | 192 | { |
| 193 | - $url = rtrim($this->getBaseURL(), '/') . '/' . $dispatcher; |
|
| 193 | + $url = rtrim($this->getBaseURL(), '/').'/'.$dispatcher; |
|
| 194 | 194 | |
| 195 | 195 | // append any leftover parameters to the end of the URL |
| 196 | 196 | if (!empty($params)) { |
| 197 | - $url .= '?' . http_build_query($params, '', '&'); |
|
| 197 | + $url .= '?'.http_build_query($params, '', '&'); |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | return $url; |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | */ |
| 226 | 226 | public function registerParam(string $name) : RequestParam |
| 227 | 227 | { |
| 228 | - if(!isset($this->knownParams[$name])) { |
|
| 228 | + if (!isset($this->knownParams[$name])) { |
|
| 229 | 229 | $param = new RequestParam($this, $name); |
| 230 | 230 | $this->knownParams[$name] = $param; |
| 231 | 231 | } |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | */ |
| 243 | 243 | public function getRegisteredParam(string $name) : RequestParam |
| 244 | 244 | { |
| 245 | - if(isset($this->knownParams[$name])) { |
|
| 245 | + if (isset($this->knownParams[$name])) { |
|
| 246 | 246 | return $this->knownParams[$name]; |
| 247 | 247 | } |
| 248 | 248 | |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | { |
| 303 | 303 | static $accept; |
| 304 | 304 | |
| 305 | - if(!isset($accept)) { |
|
| 305 | + if (!isset($accept)) { |
|
| 306 | 306 | $accept = new Request_AcceptHeaders(); |
| 307 | 307 | } |
| 308 | 308 | |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | { |
| 322 | 322 | $_REQUEST[$name] = $value; |
| 323 | 323 | |
| 324 | - if(isset($this->knownParams[$name])) { |
|
| 324 | + if (isset($this->knownParams[$name])) { |
|
| 325 | 325 | unset($this->knownParams[$name]); |
| 326 | 326 | } |
| 327 | 327 | |
@@ -351,11 +351,11 @@ discard block |
||
| 351 | 351 | */ |
| 352 | 352 | public function removeParam(string $name) : Request |
| 353 | 353 | { |
| 354 | - if(isset($_REQUEST[$name])) { |
|
| 354 | + if (isset($_REQUEST[$name])) { |
|
| 355 | 355 | unset($_REQUEST[$name]); |
| 356 | 356 | } |
| 357 | 357 | |
| 358 | - if(isset($this->knownParams[$name])) { |
|
| 358 | + if (isset($this->knownParams[$name])) { |
|
| 359 | 359 | unset($this->knownParams[$name]); |
| 360 | 360 | } |
| 361 | 361 | |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | */ |
| 371 | 371 | public function removeParams(array $names) : Request |
| 372 | 372 | { |
| 373 | - foreach($names as $name) { |
|
| 373 | + foreach ($names as $name) { |
|
| 374 | 374 | $this->removeParam($name); |
| 375 | 375 | } |
| 376 | 376 | |
@@ -388,11 +388,11 @@ discard block |
||
| 388 | 388 | * @return bool |
| 389 | 389 | * @throws ConvertHelper_Exception |
| 390 | 390 | */ |
| 391 | - public function getBool(string $name, bool $default=false) : bool |
|
| 391 | + public function getBool(string $name, bool $default = false) : bool |
|
| 392 | 392 | { |
| 393 | 393 | $value = $this->getParam($name, $default); |
| 394 | 394 | |
| 395 | - if(ConvertHelper::isBoolean($value)) { |
|
| 395 | + if (ConvertHelper::isBoolean($value)) { |
|
| 396 | 396 | return ConvertHelper::string2bool($value); |
| 397 | 397 | } |
| 398 | 398 | |
@@ -401,11 +401,11 @@ discard block |
||
| 401 | 401 | |
| 402 | 402 | public function validate() : void |
| 403 | 403 | { |
| 404 | - foreach($this->knownParams as $param) |
|
| 404 | + foreach ($this->knownParams as $param) |
|
| 405 | 405 | { |
| 406 | 406 | $name = $param->getName(); |
| 407 | 407 | |
| 408 | - if($param->isRequired() && !$this->hasParam($name)) |
|
| 408 | + if ($param->isRequired() && !$this->hasParam($name)) |
|
| 409 | 409 | { |
| 410 | 410 | throw new Request_Exception( |
| 411 | 411 | 'Missing request parameter '.$name, |
@@ -427,26 +427,26 @@ discard block |
||
| 427 | 427 | * @param mixed $default |
| 428 | 428 | * @return mixed |
| 429 | 429 | */ |
| 430 | - public function getFilteredParam(string $name, $default=null) |
|
| 430 | + public function getFilteredParam(string $name, $default = null) |
|
| 431 | 431 | { |
| 432 | 432 | $val = $this->getParam($name, $default); |
| 433 | 433 | |
| 434 | - if(is_string($val)) |
|
| 434 | + if (is_string($val)) |
|
| 435 | 435 | { |
| 436 | 436 | return htmlspecialchars(trim(strip_tags($val)), ENT_QUOTES, 'UTF-8'); |
| 437 | 437 | } |
| 438 | 438 | |
| 439 | - if(is_bool($val)) |
|
| 439 | + if (is_bool($val)) |
|
| 440 | 440 | { |
| 441 | 441 | return ConvertHelper::boolStrict2string($val); |
| 442 | 442 | } |
| 443 | 443 | |
| 444 | - if(is_numeric($val)) |
|
| 444 | + if (is_numeric($val)) |
|
| 445 | 445 | { |
| 446 | 446 | return (string)$val; |
| 447 | 447 | } |
| 448 | 448 | |
| 449 | - if(is_null($val)) |
|
| 449 | + if (is_null($val)) |
|
| 450 | 450 | { |
| 451 | 451 | return ''; |
| 452 | 452 | } |
@@ -466,11 +466,11 @@ discard block |
||
| 466 | 466 | * @see Request::getJSONObject() |
| 467 | 467 | * @see Request::getJSONAssoc() |
| 468 | 468 | */ |
| 469 | - public function getJSON(string $name, bool $assoc=true) |
|
| 469 | + public function getJSON(string $name, bool $assoc = true) |
|
| 470 | 470 | { |
| 471 | 471 | $value = $this->getParam($name); |
| 472 | 472 | |
| 473 | - if(!empty($value) && is_string($value)) |
|
| 473 | + if (!empty($value) && is_string($value)) |
|
| 474 | 474 | { |
| 475 | 475 | try |
| 476 | 476 | { |
@@ -481,16 +481,16 @@ discard block |
||
| 481 | 481 | return array(); |
| 482 | 482 | } |
| 483 | 483 | |
| 484 | - if($assoc && is_array($data)) { |
|
| 484 | + if ($assoc && is_array($data)) { |
|
| 485 | 485 | return $data; |
| 486 | 486 | } |
| 487 | 487 | |
| 488 | - if(is_object($data)) { |
|
| 488 | + if (is_object($data)) { |
|
| 489 | 489 | return $data; |
| 490 | 490 | } |
| 491 | 491 | } |
| 492 | 492 | |
| 493 | - if($assoc) { |
|
| 493 | + if ($assoc) { |
|
| 494 | 494 | return array(); |
| 495 | 495 | } |
| 496 | 496 | |
@@ -507,7 +507,7 @@ discard block |
||
| 507 | 507 | public function getJSONAssoc(string $name) : array |
| 508 | 508 | { |
| 509 | 509 | $result = $this->getJSON($name); |
| 510 | - if(is_array($result)) { |
|
| 510 | + if (is_array($result)) { |
|
| 511 | 511 | return $result; |
| 512 | 512 | } |
| 513 | 513 | |
@@ -524,7 +524,7 @@ discard block |
||
| 524 | 524 | public function getJSONObject(string $name) : object |
| 525 | 525 | { |
| 526 | 526 | $result = $this->getJSON($name, false); |
| 527 | - if(is_object($result)) { |
|
| 527 | + if (is_object($result)) { |
|
| 528 | 528 | return $result; |
| 529 | 529 | } |
| 530 | 530 | |
@@ -541,7 +541,7 @@ discard block |
||
| 541 | 541 | { |
| 542 | 542 | $payload = $data; |
| 543 | 543 | |
| 544 | - if(!is_string($payload)) { |
|
| 544 | + if (!is_string($payload)) { |
|
| 545 | 545 | $payload = json_encode($payload, JSON_THROW_ON_ERROR); |
| 546 | 546 | } |
| 547 | 547 | |
@@ -598,7 +598,7 @@ discard block |
||
| 598 | 598 | * @param string[] $limitParams Whether to limit the comparison to these specific parameter names (if present) |
| 599 | 599 | * @return Request_URLComparer |
| 600 | 600 | */ |
| 601 | - public function createURLComparer(string $sourceURL, string $targetURL, array $limitParams=array()) : Request_URLComparer |
|
| 601 | + public function createURLComparer(string $sourceURL, string $targetURL, array $limitParams = array()) : Request_URLComparer |
|
| 602 | 602 | { |
| 603 | 603 | $comparer = new Request_URLComparer($this, $sourceURL, $targetURL); |
| 604 | 604 | $comparer->addLimitParams($limitParams); |
@@ -475,8 +475,7 @@ |
||
| 475 | 475 | try |
| 476 | 476 | { |
| 477 | 477 | $data = json_decode($value, $assoc, 512, JSON_THROW_ON_ERROR); |
| 478 | - } |
|
| 479 | - catch (JsonException $e) |
|
| 478 | + } catch (JsonException $e) |
|
| 480 | 479 | { |
| 481 | 480 | return array(); |
| 482 | 481 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | public function setAttributes(array $attributes) : AttributeCollection |
| 69 | 69 | { |
| 70 | - foreach($attributes as $name => $value) |
|
| 70 | + foreach ($attributes as $name => $value) |
|
| 71 | 71 | { |
| 72 | 72 | $this->attr($name, $value); |
| 73 | 73 | } |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | return $this; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - public function getAttribute(string $name, string $default='') : string |
|
| 78 | + public function getAttribute(string $name, string $default = '') : string |
|
| 79 | 79 | { |
| 80 | 80 | return $this->attributes[$name] ?? $default; |
| 81 | 81 | } |
@@ -84,14 +84,14 @@ discard block |
||
| 84 | 84 | * @param array<string,string|number|bool|NULL|Interface_Stringable|StringBuilder_Interface> $attributes |
| 85 | 85 | * @return AttributeCollection |
| 86 | 86 | */ |
| 87 | - public static function create(array $attributes=array()) : AttributeCollection |
|
| 87 | + public static function create(array $attributes = array()) : AttributeCollection |
|
| 88 | 88 | { |
| 89 | 89 | return new AttributeCollection($attributes); |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - public function prop(string $name, bool $enabled=true) : AttributeCollection |
|
| 92 | + public function prop(string $name, bool $enabled = true) : AttributeCollection |
|
| 93 | 93 | { |
| 94 | - if($enabled) |
|
| 94 | + if ($enabled) |
|
| 95 | 95 | { |
| 96 | 96 | return $this->attr($name, $name); |
| 97 | 97 | } |
@@ -108,18 +108,18 @@ discard block |
||
| 108 | 108 | { |
| 109 | 109 | $string = Filtering::value2string($value); |
| 110 | 110 | |
| 111 | - if($name === 'class') |
|
| 111 | + if ($name === 'class') |
|
| 112 | 112 | { |
| 113 | 113 | return $this->addClasses(ConvertHelper::explodeTrim(' ', $string)); |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - if($name === 'style') |
|
| 116 | + if ($name === 'style') |
|
| 117 | 117 | { |
| 118 | 118 | $this->styles->parseStylesString($string); |
| 119 | 119 | return $this; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - if($string !== '') |
|
| 122 | + if ($string !== '') |
|
| 123 | 123 | { |
| 124 | 124 | $this->attributes[$name] = $string; |
| 125 | 125 | } |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | { |
| 139 | 139 | $this->attr($name, $value); |
| 140 | 140 | |
| 141 | - if(isset($this->attributes[$name])) |
|
| 141 | + if (isset($this->attributes[$name])) |
|
| 142 | 142 | { |
| 143 | 143 | $this->attributes[$name] = Filtering::quotes($this->attributes[$name]); |
| 144 | 144 | } |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | |
| 154 | 154 | public function remove(string $name) : AttributeCollection |
| 155 | 155 | { |
| 156 | - if(isset($this->attributes[$name])) |
|
| 156 | + if (isset($this->attributes[$name])) |
|
| 157 | 157 | { |
| 158 | 158 | unset($this->attributes[$name]); |
| 159 | 159 | } |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | |
| 176 | 176 | private function getRenderer() : AttributesRenderer |
| 177 | 177 | { |
| 178 | - if(isset($this->renderer)) |
|
| 178 | + if (isset($this->renderer)) |
|
| 179 | 179 | { |
| 180 | 180 | return $this->renderer; |
| 181 | 181 | } |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | |
| 239 | 239 | public const TARGET_BLANK = '_blank'; |
| 240 | 240 | |
| 241 | - public function target(string $value=self::TARGET_BLANK) : AttributeCollection |
|
| 241 | + public function target(string $value = self::TARGET_BLANK) : AttributeCollection |
|
| 242 | 242 | { |
| 243 | 243 | return $this->attr('target', $value); |
| 244 | 244 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | { |
| 23 | 23 | $info = FileHelper::getFolderInfo($rootFolder); |
| 24 | 24 | |
| 25 | - if(!$info->exists()) |
|
| 25 | + if (!$info->exists()) |
|
| 26 | 26 | { |
| 27 | 27 | return true; |
| 28 | 28 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | foreach ($d as $item) |
| 33 | 33 | { |
| 34 | - if(self::processDeleteItem($item) === false) |
|
| 34 | + if (self::processDeleteItem($item) === false) |
|
| 35 | 35 | { |
| 36 | 36 | return false; |
| 37 | 37 | } |
@@ -100,11 +100,11 @@ discard block |
||
| 100 | 100 | { |
| 101 | 101 | $target = FileHelper::createFolder($target); |
| 102 | 102 | |
| 103 | - $d = FileHelper::getPathInfo($source)->requireIsFolder()->getIterator(); |
|
| 103 | + $d = FileHelper::getPathInfo($source)->requireIsFolder()->getIterator(); |
|
| 104 | 104 | |
| 105 | 105 | foreach ($d as $item) |
| 106 | 106 | { |
| 107 | - if($item->isDot()) |
|
| 107 | + if ($item->isDot()) |
|
| 108 | 108 | { |
| 109 | 109 | continue; |
| 110 | 110 | } |
@@ -125,9 +125,9 @@ discard block |
||
| 125 | 125 | |
| 126 | 126 | if ($item->isFolder()) |
| 127 | 127 | { |
| 128 | - self::copy($item, $target . '/' . $item->getName()); |
|
| 128 | + self::copy($item, $target.'/'.$item->getName()); |
|
| 129 | 129 | } |
| 130 | - else if($item->isFile()) |
|
| 130 | + else if ($item->isFile()) |
|
| 131 | 131 | { |
| 132 | 132 | $item |
| 133 | 133 | ->requireIsFile() |
@@ -42,8 +42,7 @@ discard block |
||
| 42 | 42 | { |
| 43 | 43 | $info->delete(); |
| 44 | 44 | return true; |
| 45 | - } |
|
| 46 | - catch (FileHelper_Exception $e) |
|
| 45 | + } catch (FileHelper_Exception $e) |
|
| 47 | 46 | { |
| 48 | 47 | // Ignore the exception, since we're returning false instead. |
| 49 | 48 | } |
@@ -78,8 +77,7 @@ discard block |
||
| 78 | 77 | try |
| 79 | 78 | { |
| 80 | 79 | FileHelper::deleteFile($item); |
| 81 | - } |
|
| 82 | - catch (FileHelper_Exception $e) |
|
| 80 | + } catch (FileHelper_Exception $e) |
|
| 83 | 81 | { |
| 84 | 82 | return false; |
| 85 | 83 | } |
@@ -125,8 +123,7 @@ discard block |
||
| 125 | 123 | if ($item->isFolder()) |
| 126 | 124 | { |
| 127 | 125 | self::copy($item, $target . '/' . $item->getName()); |
| 128 | - } |
|
| 129 | - else if($item->isFile()) |
|
| 126 | + } else if($item->isFile()) |
|
| 130 | 127 | { |
| 131 | 128 | $item |
| 132 | 129 | ->requireIsFile() |
@@ -29,22 +29,22 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | public static function fromString($string) : bool |
| 31 | 31 | { |
| 32 | - if($string === '' || !is_scalar($string)) |
|
| 32 | + if ($string === '' || !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(is_string($string)) |
|
| 42 | + if (is_string($string)) |
|
| 43 | 43 | { |
| 44 | 44 | $string = strtolower($string); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - if(array_key_exists($string, self::$booleanStrings)) |
|
| 47 | + if (array_key_exists($string, self::$booleanStrings)) |
|
| 48 | 48 | { |
| 49 | 49 | return self::$booleanStrings[$string]; |
| 50 | 50 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | public static function toString($boolean, bool $yesno = false) : string |
| 75 | 75 | { |
| 76 | 76 | // allow 'yes', 'true', 'no', 'false' string notations as well |
| 77 | - if(!is_bool($boolean)) { |
|
| 77 | + if (!is_bool($boolean)) { |
|
| 78 | 78 | $boolean = self::fromString($boolean); |
| 79 | 79 | } |
| 80 | 80 | |
@@ -130,11 +130,11 @@ discard block |
||
| 130 | 130 | */ |
| 131 | 131 | public static function isBoolean($value) : bool |
| 132 | 132 | { |
| 133 | - if(is_bool($value)) { |
|
| 133 | + if (is_bool($value)) { |
|
| 134 | 134 | return true; |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - if(!is_scalar($value)) { |
|
| 137 | + if (!is_scalar($value)) { |
|
| 138 | 138 | return false; |
| 139 | 139 | } |
| 140 | 140 | |
@@ -43,13 +43,13 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | public static function factory($path) : JSONFile |
| 45 | 45 | { |
| 46 | - if($path instanceof self) { |
|
| 46 | + if ($path instanceof self) { |
|
| 47 | 47 | return $path; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | $instance = self::createInstance($path); |
| 51 | 51 | |
| 52 | - if($instance instanceof self) { |
|
| 52 | + if ($instance instanceof self) { |
|
| 53 | 53 | return $instance; |
| 54 | 54 | } |
| 55 | 55 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | |
| 129 | 129 | private function convertEncoding(string $contents) : string |
| 130 | 130 | { |
| 131 | - if(!empty($this->targetEncoding)) |
|
| 131 | + if (!empty($this->targetEncoding)) |
|
| 132 | 132 | { |
| 133 | 133 | return (string)mb_convert_encoding( |
| 134 | 134 | $contents, |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | { |
| 151 | 151 | $options = null; |
| 152 | 152 | |
| 153 | - if($pretty) |
|
| 153 | + if ($pretty) |
|
| 154 | 154 | { |
| 155 | 155 | $options = JSON_PRETTY_PRINT; |
| 156 | 156 | } |
@@ -101,8 +101,7 @@ discard block |
||
| 101 | 101 | 512, |
| 102 | 102 | JSON_THROW_ON_ERROR |
| 103 | 103 | ); |
| 104 | - } |
|
| 105 | - catch (JsonException $e) |
|
| 104 | + } catch (JsonException $e) |
|
| 106 | 105 | { |
| 107 | 106 | throw new FileHelper_Exception( |
| 108 | 107 | 'Cannot decode json data', |
@@ -162,8 +161,7 @@ discard block |
||
| 162 | 161 | $this->putContents($json); |
| 163 | 162 | |
| 164 | 163 | return $this; |
| 165 | - } |
|
| 166 | - catch (JsonException $e) |
|
| 164 | + } catch (JsonException $e) |
|
| 167 | 165 | { |
| 168 | 166 | throw new FileHelper_Exception( |
| 169 | 167 | 'An error occurred while encoding a data set to JSON.', |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | $path = realpath($this->path); |
| 98 | 98 | |
| 99 | - if($path !== false) |
|
| 99 | + if ($path !== false) |
|
| 100 | 100 | { |
| 101 | 101 | return FileHelper::normalizePath($path); |
| 102 | 102 | } |
@@ -115,14 +115,14 @@ discard block |
||
| 115 | 115 | * @return $this |
| 116 | 116 | * @throws FileHelper_Exception |
| 117 | 117 | */ |
| 118 | - private function requireTrue(bool $condition, string $conditionLabel, ?int $errorCode=null) : self |
|
| 118 | + private function requireTrue(bool $condition, string $conditionLabel, ?int $errorCode = null) : self |
|
| 119 | 119 | { |
| 120 | - if($condition === true) |
|
| 120 | + if ($condition === true) |
|
| 121 | 121 | { |
| 122 | 122 | return $this; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - if($errorCode === null) |
|
| 125 | + if ($errorCode === null) |
|
| 126 | 126 | { |
| 127 | 127 | $errorCode = FileHelper::ERROR_FILE_DOES_NOT_EXIST; |
| 128 | 128 | } |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | * @return $this |
| 140 | 140 | * @throws FileHelper_Exception |
| 141 | 141 | */ |
| 142 | - public function requireExists(?int $errorCode=null) : self |
|
| 142 | + public function requireExists(?int $errorCode = null) : self |
|
| 143 | 143 | { |
| 144 | 144 | return $this->requireTrue( |
| 145 | 145 | !empty($this->path) && realpath($this->path) !== false, |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | * @return $this |
| 154 | 154 | * @throws FileHelper_Exception |
| 155 | 155 | */ |
| 156 | - public function requireReadable(?int $errorCode=null) : self |
|
| 156 | + public function requireReadable(?int $errorCode = null) : self |
|
| 157 | 157 | { |
| 158 | 158 | $this->requireExists($errorCode); |
| 159 | 159 | |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | * @return $this |
| 170 | 170 | * @throws FileHelper_Exception |
| 171 | 171 | */ |
| 172 | - public function requireWritable(?int $errorCode=null) : self |
|
| 172 | + public function requireWritable(?int $errorCode = null) : self |
|
| 173 | 173 | { |
| 174 | 174 | return $this->requireTrue( |
| 175 | 175 | $this->isWritable(), |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | */ |
| 187 | 187 | public function requireIsFile() : FileInfo |
| 188 | 188 | { |
| 189 | - if($this instanceof FileInfo) |
|
| 189 | + if ($this instanceof FileInfo) |
|
| 190 | 190 | { |
| 191 | 191 | return $this; |
| 192 | 192 | } |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | */ |
| 210 | 210 | public function requireIsFolder() : FolderInfo |
| 211 | 211 | { |
| 212 | - if($this instanceof FolderInfo) |
|
| 212 | + if ($this instanceof FolderInfo) |
|
| 213 | 213 | { |
| 214 | 214 | return $this; |
| 215 | 215 | } |
@@ -230,12 +230,12 @@ discard block |
||
| 230 | 230 | */ |
| 231 | 231 | public static function type2string($path) : string |
| 232 | 232 | { |
| 233 | - if($path instanceof PathInfoInterface) |
|
| 233 | + if ($path instanceof PathInfoInterface) |
|
| 234 | 234 | { |
| 235 | 235 | return $path->getPath(); |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | - if($path instanceof SplFileInfo) |
|
| 238 | + if ($path instanceof SplFileInfo) |
|
| 239 | 239 | { |
| 240 | 240 | return $path->getPathname(); |
| 241 | 241 | } |
@@ -257,19 +257,19 @@ discard block |
||
| 257 | 257 | */ |
| 258 | 258 | public static function resolveType($path) : PathInfoInterface |
| 259 | 259 | { |
| 260 | - if($path instanceof PathInfoInterface) |
|
| 260 | + if ($path instanceof PathInfoInterface) |
|
| 261 | 261 | { |
| 262 | 262 | return $path; |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | $path = self::type2string($path); |
| 266 | 266 | |
| 267 | - if(FolderInfo::is_dir($path)) |
|
| 267 | + if (FolderInfo::is_dir($path)) |
|
| 268 | 268 | { |
| 269 | 269 | return FolderInfo::factory($path); |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | - if(FileInfo::is_file($path)) |
|
| 272 | + if (FileInfo::is_file($path)) |
|
| 273 | 273 | { |
| 274 | 274 | return FileInfo::factory($path); |
| 275 | 275 | } |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | public function getModifiedDate() : ?DateTime |
| 328 | 328 | { |
| 329 | 329 | $time = filemtime($this->getPath()); |
| 330 | - if($time === false) { |
|
| 330 | + if ($time === false) { |
|
| 331 | 331 | return null; |
| 332 | 332 | } |
| 333 | 333 | |
@@ -35,11 +35,11 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | protected $classes = array(); |
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * @param PHPFile $path The path to the PHP file to parse. |
|
| 40 | - * @throws FileHelper_Exception |
|
| 41 | - * @see FileHelper::findPHPClasses() |
|
| 42 | - */ |
|
| 38 | + /** |
|
| 39 | + * @param PHPFile $path The path to the PHP file to parse. |
|
| 40 | + * @throws FileHelper_Exception |
|
| 41 | + * @see FileHelper::findPHPClasses() |
|
| 42 | + */ |
|
| 43 | 43 | public function __construct(PHPFile $path) |
| 44 | 44 | { |
| 45 | 45 | $this->file = $path |
@@ -49,58 +49,58 @@ discard block |
||
| 49 | 49 | $this->parseFile(); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * The name of the namespace of the classes in the file, if any. |
|
| 54 | - * @return string |
|
| 55 | - */ |
|
| 52 | + /** |
|
| 53 | + * The name of the namespace of the classes in the file, if any. |
|
| 54 | + * @return string |
|
| 55 | + */ |
|
| 56 | 56 | public function getNamespace() : string |
| 57 | 57 | { |
| 58 | 58 | return $this->namespace; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * Whether the file contains a namespace. |
|
| 63 | - * @return bool |
|
| 64 | - */ |
|
| 61 | + /** |
|
| 62 | + * Whether the file contains a namespace. |
|
| 63 | + * @return bool |
|
| 64 | + */ |
|
| 65 | 65 | public function hasNamespace() : bool |
| 66 | 66 | { |
| 67 | 67 | return !empty($this->namespace); |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - /** |
|
| 71 | - * The absolute path to the file. |
|
| 72 | - * @return string |
|
| 73 | - */ |
|
| 70 | + /** |
|
| 71 | + * The absolute path to the file. |
|
| 72 | + * @return string |
|
| 73 | + */ |
|
| 74 | 74 | public function getPath() : string |
| 75 | 75 | { |
| 76 | 76 | return $this->file->getPath(); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - /** |
|
| 80 | - * Whether any classes were found in the file. |
|
| 81 | - * @return bool |
|
| 82 | - */ |
|
| 79 | + /** |
|
| 80 | + * Whether any classes were found in the file. |
|
| 81 | + * @return bool |
|
| 82 | + */ |
|
| 83 | 83 | public function hasClasses() : bool |
| 84 | 84 | { |
| 85 | 85 | return !empty($this->classes); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - /** |
|
| 89 | - * The names of the classes that were found in the file (with namespace if any). |
|
| 90 | - * @return string[] |
|
| 91 | - */ |
|
| 88 | + /** |
|
| 89 | + * The names of the classes that were found in the file (with namespace if any). |
|
| 90 | + * @return string[] |
|
| 91 | + */ |
|
| 92 | 92 | public function getClassNames() : array |
| 93 | 93 | { |
| 94 | 94 | return array_keys($this->classes); |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - /** |
|
| 98 | - * Retrieves all classes that were detected in the file, |
|
| 99 | - * which can be used to retrieve more information about |
|
| 100 | - * them. |
|
| 101 | - * |
|
| 102 | - * @return FileHelper_PHPClassInfo_Class[] |
|
| 103 | - */ |
|
| 97 | + /** |
|
| 98 | + * Retrieves all classes that were detected in the file, |
|
| 99 | + * which can be used to retrieve more information about |
|
| 100 | + * them. |
|
| 101 | + * |
|
| 102 | + * @return FileHelper_PHPClassInfo_Class[] |
|
| 103 | + */ |
|
| 104 | 104 | public function getClasses() : array |
| 105 | 105 | { |
| 106 | 106 | return array_values($this->classes); |
@@ -146,13 +146,13 @@ discard block |
||
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - /** |
|
| 150 | - * Strips all whitespace from the string, replacing it with |
|
| 151 | - * regular spaces (newlines, tabs, etc.). |
|
| 152 | - * |
|
| 153 | - * @param string $string |
|
| 154 | - * @return string |
|
| 155 | - */ |
|
| 149 | + /** |
|
| 150 | + * Strips all whitespace from the string, replacing it with |
|
| 151 | + * regular spaces (newlines, tabs, etc.). |
|
| 152 | + * |
|
| 153 | + * @param string $string |
|
| 154 | + * @return string |
|
| 155 | + */ |
|
| 156 | 156 | protected function stripWhitespace(string $string) : string |
| 157 | 157 | { |
| 158 | 158 | return preg_replace('/\s/', ' ', $string); |
@@ -112,25 +112,25 @@ |
||
| 112 | 112 | |
| 113 | 113 | $result = array(); |
| 114 | 114 | preg_match_all('/namespace\s+([^;]+);/ix', $code, $result, PREG_PATTERN_ORDER); |
| 115 | - if(isset($result[0][0])) { |
|
| 115 | + if (isset($result[0][0])) { |
|
| 116 | 116 | $this->namespace = trim($result[1][0]); |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | $result = array(); |
| 120 | 120 | preg_match_all('/(abstract|final)\s+(class|trait)\s+([\sa-z\d\\\\_,]+){|(class|trait)\s+([\sa-z\d\\\\_,]+){/ix', $code, $result, PREG_PATTERN_ORDER); |
| 121 | 121 | |
| 122 | - if(!isset($result[0][0])) { |
|
| 122 | + if (!isset($result[0][0])) { |
|
| 123 | 123 | return; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | $indexes = array_keys($result[0]); |
| 127 | 127 | |
| 128 | - foreach($indexes as $idx) |
|
| 128 | + foreach ($indexes as $idx) |
|
| 129 | 129 | { |
| 130 | 130 | $keyword = $result[1][$idx]; |
| 131 | 131 | $declaration = $result[3][$idx]; |
| 132 | 132 | $type = $result[2][$idx]; |
| 133 | - if(empty($keyword)) { |
|
| 133 | + if (empty($keyword)) { |
|
| 134 | 134 | $type = $result[4][$idx]; |
| 135 | 135 | $declaration = $result[5][$idx]; |
| 136 | 136 | } |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | interface PathInfoInterface |
| 25 | 25 | { |
| 26 | 26 | public function getName() : string; |
| 27 | - public function getExtension(bool $lowercase=true) : string; |
|
| 27 | + public function getExtension(bool $lowercase = true) : string; |
|
| 28 | 28 | public function getPath() : string; |
| 29 | 29 | public function getFolderPath() : string; |
| 30 | 30 | public function exists() : bool; |
@@ -32,13 +32,13 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | public static function factory($path) : SerializedFile |
| 34 | 34 | { |
| 35 | - if($path instanceof self) { |
|
| 35 | + if ($path instanceof self) { |
|
| 36 | 36 | return $path; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | $instance = self::createInstance($path); |
| 40 | 40 | |
| 41 | - if($instance instanceof self) { |
|
| 41 | + if ($instance instanceof self) { |
|
| 42 | 42 | return $instance; |
| 43 | 43 | } |
| 44 | 44 | |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | ) |
| 74 | 74 | ); |
| 75 | 75 | |
| 76 | - if($result !== false) { |
|
| 76 | + if ($result !== false) { |
|
| 77 | 77 | return $result; |
| 78 | 78 | } |
| 79 | 79 | |