@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | * @see \AppUtils\FileHelper\FileFinder |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -declare(strict_types = 1); |
|
| 10 | +declare(strict_types=1); |
|
| 11 | 11 | |
| 12 | 12 | namespace AppUtils\FileHelper; |
| 13 | 13 | |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | * @param bool $enabled |
| 91 | 91 | * @return FileFinder |
| 92 | 92 | */ |
| 93 | - public function makeRecursive(bool $enabled=true) : FileFinder |
|
| 93 | + public function makeRecursive(bool $enabled = true) : FileFinder |
|
| 94 | 94 | { |
| 95 | 95 | return $this->setOption('recursive', $enabled); |
| 96 | 96 | } |
@@ -295,22 +295,22 @@ discard block |
||
| 295 | 295 | return $this->getAll(); |
| 296 | 296 | } |
| 297 | 297 | |
| 298 | - protected function find(string $path, bool $isRoot=false) : void |
|
| 298 | + protected function find(string $path, bool $isRoot = false) : void |
|
| 299 | 299 | { |
| 300 | - if($isRoot) { |
|
| 300 | + if ($isRoot) { |
|
| 301 | 301 | $this->found = array(); |
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | $recursive = $this->getBoolOption('recursive'); |
| 305 | 305 | |
| 306 | 306 | $d = new DirectoryIterator($path); |
| 307 | - foreach($d as $item) |
|
| 307 | + foreach ($d as $item) |
|
| 308 | 308 | { |
| 309 | 309 | $pathname = $item->getPathname(); |
| 310 | 310 | |
| 311 | - if($item->isDir()) |
|
| 311 | + if ($item->isDir()) |
|
| 312 | 312 | { |
| 313 | - if($recursive && !$item->isDot()) { |
|
| 313 | + if ($recursive && !$item->isDot()) { |
|
| 314 | 314 | $this->find($pathname); |
| 315 | 315 | } |
| 316 | 316 | |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | |
| 320 | 320 | $file = $this->filterFile($pathname); |
| 321 | 321 | |
| 322 | - if($file !== null) |
|
| 322 | + if ($file !== null) |
|
| 323 | 323 | { |
| 324 | 324 | $this->found[] = $file; |
| 325 | 325 | } |
@@ -332,23 +332,23 @@ discard block |
||
| 332 | 332 | |
| 333 | 333 | $extension = FileHelper::getExtension($path); |
| 334 | 334 | |
| 335 | - if(!$this->filterExclusion($extension)) { |
|
| 335 | + if (!$this->filterExclusion($extension)) { |
|
| 336 | 336 | return null; |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | $path = $this->filterPath($path); |
| 340 | 340 | |
| 341 | - if($this->getOption('strip-extensions') === true) |
|
| 341 | + if ($this->getOption('strip-extensions') === true) |
|
| 342 | 342 | { |
| 343 | 343 | $path = str_replace('.'.$extension, '', $path); |
| 344 | 344 | } |
| 345 | 345 | |
| 346 | - if($path === '') { |
|
| 346 | + if ($path === '') { |
|
| 347 | 347 | return null; |
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | $replace = $this->getOption('slash-replacement'); |
| 351 | - if(!empty($replace)) { |
|
| 351 | + if (!empty($replace)) { |
|
| 352 | 352 | $path = str_replace('/', $replace, $path); |
| 353 | 353 | } |
| 354 | 354 | |
@@ -367,13 +367,13 @@ discard block |
||
| 367 | 367 | $include = $this->getOption(self::OPTION_INCLUDE_EXTENSIONS); |
| 368 | 368 | $exclude = $this->getOption(self::OPTION_EXCLUDE_EXTENSIONS); |
| 369 | 369 | |
| 370 | - if(!empty($include)) |
|
| 370 | + if (!empty($include)) |
|
| 371 | 371 | { |
| 372 | - if(!in_array($extension, $include, true)) { |
|
| 372 | + if (!in_array($extension, $include, true)) { |
|
| 373 | 373 | return false; |
| 374 | 374 | } |
| 375 | 375 | } |
| 376 | - else if(!empty($exclude) && in_array($extension, $exclude, true)) |
|
| 376 | + else if (!empty($exclude) && in_array($extension, $exclude, true)) |
|
| 377 | 377 | { |
| 378 | 378 | return false; |
| 379 | 379 | } |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | */ |
| 390 | 390 | protected function filterPath(string $path) : string |
| 391 | 391 | { |
| 392 | - switch($this->getStringOption(self::OPTION_PATHMODE)) |
|
| 392 | + switch ($this->getStringOption(self::OPTION_PATHMODE)) |
|
| 393 | 393 | { |
| 394 | 394 | case self::PATH_MODE_STRIP: |
| 395 | 395 | return basename($path); |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | * @return $this |
| 125 | 125 | * @throws Request_Exception |
| 126 | 126 | */ |
| 127 | - public function setCallback(callable $callback, array $args=array()) : self |
|
| 127 | + public function setCallback(callable $callback, array $args = array()) : self |
|
| 128 | 128 | { |
| 129 | 129 | return $this->setValidation( |
| 130 | 130 | self::VALIDATION_TYPE_CALLBACK, |
@@ -149,22 +149,22 @@ discard block |
||
| 149 | 149 | // first off, apply filtering |
| 150 | 150 | $value = $this->filter($value); |
| 151 | 151 | |
| 152 | - if($this->valueType === self::VALUE_TYPE_LIST) |
|
| 152 | + if ($this->valueType === self::VALUE_TYPE_LIST) |
|
| 153 | 153 | { |
| 154 | - if(!is_array($value)) |
|
| 154 | + if (!is_array($value)) |
|
| 155 | 155 | { |
| 156 | 156 | $value = explode(',', $value); |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | $keep = array(); |
| 160 | 160 | |
| 161 | - foreach($value as $subval) |
|
| 161 | + foreach ($value as $subval) |
|
| 162 | 162 | { |
| 163 | 163 | $subval = $this->filter($subval); |
| 164 | 164 | |
| 165 | 165 | $subval = $this->applyValidations($subval, true); |
| 166 | 166 | |
| 167 | - if($subval !== null) { |
|
| 167 | + if ($subval !== null) { |
|
| 168 | 168 | $keep[] = $subval; |
| 169 | 169 | } |
| 170 | 170 | } |
@@ -183,11 +183,11 @@ discard block |
||
| 183 | 183 | * @param mixed $value |
| 184 | 184 | * @return mixed |
| 185 | 185 | */ |
| 186 | - protected function applyValidations($value, bool $subval=false) |
|
| 186 | + protected function applyValidations($value, bool $subval = false) |
|
| 187 | 187 | { |
| 188 | 188 | // go through all enqueued validations in turn, each time |
| 189 | 189 | // replacing the value with the adjusted, validated value. |
| 190 | - foreach($this->validations as $validateDef) |
|
| 190 | + foreach ($this->validations as $validateDef) |
|
| 191 | 191 | { |
| 192 | 192 | $value = $this->validateType($value, $validateDef['type'], $validateDef['params'], $subval); |
| 193 | 193 | } |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | { |
| 211 | 211 | $class = Request_Param_Validator::class.'_'.ucfirst($type); |
| 212 | 212 | |
| 213 | - if(!class_exists($class)) |
|
| 213 | + if (!class_exists($class)) |
|
| 214 | 214 | { |
| 215 | 215 | throw new Request_Exception( |
| 216 | 216 | 'Unknown validation type.', |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | { |
| 362 | 362 | $args = func_get_args(); // cannot be used as function parameter in some PHP versions |
| 363 | 363 | |
| 364 | - if(is_array($args[0])) |
|
| 364 | + if (is_array($args[0])) |
|
| 365 | 365 | { |
| 366 | 366 | $args = $args[0]; |
| 367 | 367 | } |
@@ -511,10 +511,10 @@ discard block |
||
| 511 | 511 | * @param mixed $default |
| 512 | 512 | * @return mixed |
| 513 | 513 | */ |
| 514 | - public function get($default=null) |
|
| 514 | + public function get($default = null) |
|
| 515 | 515 | { |
| 516 | 516 | $value = $this->request->getParam($this->paramName); |
| 517 | - if($value !== null && $value !== '') { |
|
| 517 | + if ($value !== null && $value !== '') { |
|
| 518 | 518 | return $value; |
| 519 | 519 | } |
| 520 | 520 | |
@@ -538,7 +538,7 @@ discard block |
||
| 538 | 538 | { |
| 539 | 539 | foreach ($this->filters as $filter) |
| 540 | 540 | { |
| 541 | - $method = 'applyFilter_' . $filter['type']; |
|
| 541 | + $method = 'applyFilter_'.$filter['type']; |
|
| 542 | 542 | $value = $this->$method($value, $filter['params']); |
| 543 | 543 | } |
| 544 | 544 | |
@@ -557,7 +557,7 @@ discard block |
||
| 557 | 557 | |
| 558 | 558 | $filter = new $class($this); |
| 559 | 559 | |
| 560 | - if($filter instanceof Request_Param_Filter) |
|
| 560 | + if ($filter instanceof Request_Param_Filter) |
|
| 561 | 561 | { |
| 562 | 562 | $filter->setOptions($config['params']); |
| 563 | 563 | return $filter->filter($value); |
@@ -716,7 +716,7 @@ discard block |
||
| 716 | 716 | * @param bool $stripEmptyEntries Remove empty entries from the array? |
| 717 | 717 | * @return $this |
| 718 | 718 | */ |
| 719 | - public function addCommaSeparatedFilter(bool $trimEntries=true, bool $stripEmptyEntries=true) : self |
|
| 719 | + public function addCommaSeparatedFilter(bool $trimEntries = true, bool $stripEmptyEntries = true) : self |
|
| 720 | 720 | { |
| 721 | 721 | $this->setArray(); |
| 722 | 722 | |
@@ -735,7 +735,7 @@ discard block |
||
| 735 | 735 | * @return $this |
| 736 | 736 | * @throws Request_Exception |
| 737 | 737 | */ |
| 738 | - protected function addClassFilter(string $name, array $params=array()) : self |
|
| 738 | + protected function addClassFilter(string $name, array $params = array()) : self |
|
| 739 | 739 | { |
| 740 | 740 | return $this->addFilter( |
| 741 | 741 | self::FILTER_TYPE_CLASS, |
@@ -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() |
@@ -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 | |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | public function setMinWords(int $min) : self |
| 123 | 123 | { |
| 124 | 124 | // Avoid a reset if the value is the same |
| 125 | - if($this->minWords === $min) |
|
| 125 | + if ($this->minWords === $min) |
|
| 126 | 126 | { |
| 127 | 127 | return $this; |
| 128 | 128 | } |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | private function detect() : void |
| 144 | 144 | { |
| 145 | - if($this->detected) { |
|
| 145 | + if ($this->detected) { |
|
| 146 | 146 | return; |
| 147 | 147 | } |
| 148 | 148 | |
@@ -150,15 +150,15 @@ discard block |
||
| 150 | 150 | $this->found = array(); |
| 151 | 151 | $this->count = 0; |
| 152 | 152 | |
| 153 | - foreach(self::$words as $word) |
|
| 153 | + foreach (self::$words as $word) |
|
| 154 | 154 | { |
| 155 | - if(stripos($this->subject, $word) !== false) |
|
| 155 | + if (stripos($this->subject, $word) !== false) |
|
| 156 | 156 | { |
| 157 | 157 | $this->count++; |
| 158 | 158 | $this->found[] = $word; |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - if($this->count >= $this->minWords) { |
|
| 161 | + if ($this->count >= $this->minWords) { |
|
| 162 | 162 | break; |
| 163 | 163 | } |
| 164 | 164 | } |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | /** |
| 34 | 34 | * @param array<string,string|number|NumberInfo|Interface_Stringable|NULL> $styles |
| 35 | 35 | */ |
| 36 | - public function __construct(array $styles=array()) |
|
| 36 | + public function __construct(array $styles = array()) |
|
| 37 | 37 | { |
| 38 | 38 | $this->options = new StyleOptions(); |
| 39 | 39 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | * @param array<string,string|number|NumberInfo|Interface_Stringable|NULL> $styles |
| 45 | 45 | * @return StyleCollection |
| 46 | 46 | */ |
| 47 | - public static function create(array $styles=array()) : StyleCollection |
|
| 47 | + public static function create(array $styles = array()) : StyleCollection |
|
| 48 | 48 | { |
| 49 | 49 | return new StyleCollection($styles); |
| 50 | 50 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | { |
| 69 | 69 | $lines = explode(';', $string); |
| 70 | 70 | |
| 71 | - foreach($lines as $line) |
|
| 71 | + foreach ($lines as $line) |
|
| 72 | 72 | { |
| 73 | 73 | $parts = explode(':', $line); |
| 74 | 74 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | public function setStyles(array $styles) : StyleCollection |
| 91 | 91 | { |
| 92 | - foreach($styles as $name => $value) |
|
| 92 | + foreach ($styles as $name => $value) |
|
| 93 | 93 | { |
| 94 | 94 | $this->styleAuto($name, $value); |
| 95 | 95 | } |
@@ -105,14 +105,14 @@ discard block |
||
| 105 | 105 | * @param bool $important |
| 106 | 106 | * @return $this |
| 107 | 107 | */ |
| 108 | - public function style(string $name, string $value, bool $important=false) : StyleCollection |
|
| 108 | + public function style(string $name, string $value, bool $important = false) : StyleCollection |
|
| 109 | 109 | { |
| 110 | - if($value === '') |
|
| 110 | + if ($value === '') |
|
| 111 | 111 | { |
| 112 | 112 | return $this; |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - if($important && stripos($value, '!important') === false) |
|
| 115 | + if ($important && stripos($value, '!important') === false) |
|
| 116 | 116 | { |
| 117 | 117 | $value .= ' !important'; |
| 118 | 118 | } |
@@ -130,9 +130,9 @@ discard block |
||
| 130 | 130 | * @param bool $important |
| 131 | 131 | * @return $this |
| 132 | 132 | */ |
| 133 | - public function styleAuto(string $name, $value, bool $important=false) : StyleCollection |
|
| 133 | + public function styleAuto(string $name, $value, bool $important = false) : StyleCollection |
|
| 134 | 134 | { |
| 135 | - if($value instanceof NumberInfo) |
|
| 135 | + if ($value instanceof NumberInfo) |
|
| 136 | 136 | { |
| 137 | 137 | return $this->style($name, $value->toCSS(), $important); |
| 138 | 138 | } |
@@ -140,22 +140,22 @@ discard block |
||
| 140 | 140 | return $this->style($name, (string)$value, $important); |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - public function stylePX(string $name, int $px, bool $important=false) : StyleCollection |
|
| 143 | + public function stylePX(string $name, int $px, bool $important = false) : StyleCollection |
|
| 144 | 144 | { |
| 145 | 145 | return $this->style($name, $px.'px', $important); |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - public function stylePercent(string $name, float $percent, bool $important=false) : StyleCollection |
|
| 148 | + public function stylePercent(string $name, float $percent, bool $important = false) : StyleCollection |
|
| 149 | 149 | { |
| 150 | 150 | return $this->style($name, $percent.'%', $important); |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - public function styleEM(string $name, float $em, bool $important=false) : StyleCollection |
|
| 153 | + public function styleEM(string $name, float $em, bool $important = false) : StyleCollection |
|
| 154 | 154 | { |
| 155 | 155 | return $this->style($name, $em.'em', $important); |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - public function styleREM(string $name, float $em, bool $important=false) : StyleCollection |
|
| 158 | + public function styleREM(string $name, float $em, bool $important = false) : StyleCollection |
|
| 159 | 159 | { |
| 160 | 160 | return $this->style($name, $em.'rem', $important); |
| 161 | 161 | } |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | * @param bool $important |
| 170 | 170 | * @return $this |
| 171 | 171 | */ |
| 172 | - public function styleParseNumber(string $name, $value, bool $important=false) : StyleCollection |
|
| 172 | + public function styleParseNumber(string $name, $value, bool $important = false) : StyleCollection |
|
| 173 | 173 | { |
| 174 | 174 | return $this->styleNumber($name, parseNumber($value), $important); |
| 175 | 175 | } |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | * @param bool $important |
| 183 | 183 | * @return $this |
| 184 | 184 | */ |
| 185 | - public function styleNumber(string $name, NumberInfo $info, bool $important=false) : StyleCollection |
|
| 185 | + public function styleNumber(string $name, NumberInfo $info, bool $important = false) : StyleCollection |
|
| 186 | 186 | { |
| 187 | 187 | $this->style($name, $info->toCSS(), $important); |
| 188 | 188 | return $this; |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | |
| 191 | 191 | public function remove(string $name) : StyleCollection |
| 192 | 192 | { |
| 193 | - if(isset($this->styles[$name])) |
|
| 193 | + if (isset($this->styles[$name])) |
|
| 194 | 194 | { |
| 195 | 195 | unset($this->styles[$name]); |
| 196 | 196 | } |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | { |
| 227 | 227 | $all = self::create(); |
| 228 | 228 | |
| 229 | - foreach($collections as $collection) |
|
| 229 | + foreach ($collections as $collection) |
|
| 230 | 230 | { |
| 231 | 231 | $all->mergeWith($collection); |
| 232 | 232 | } |
@@ -31,14 +31,14 @@ discard block |
||
| 31 | 31 | * @param int|NULL $code |
| 32 | 32 | * @param Throwable|NULL $previous |
| 33 | 33 | */ |
| 34 | - public function __construct(string $message, ?string $details=null, ?int $code=null, ?Throwable $previous=null) |
|
| 34 | + public function __construct(string $message, ?string $details = null, ?int $code = null, ?Throwable $previous = null) |
|
| 35 | 35 | { |
| 36 | - if(defined('APP_UTILS_TESTSUITE') && APP_UTILS_TESTSUITE === 'true') |
|
| 36 | + if (defined('APP_UTILS_TESTSUITE') && APP_UTILS_TESTSUITE === 'true') |
|
| 37 | 37 | { |
| 38 | 38 | $message .= PHP_EOL.$details; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - if($code === null) |
|
| 41 | + if ($code === null) |
|
| 42 | 42 | { |
| 43 | 43 | $code = 0; |
| 44 | 44 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public function display() : void |
| 64 | 64 | { |
| 65 | - if(!headers_sent()) { |
|
| 65 | + if (!headers_sent()) { |
|
| 66 | 66 | header('Content-type:text/plain; charset=utf-8'); |
| 67 | 67 | } |
| 68 | 68 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | { |
| 90 | 90 | throw new BaseException(''); |
| 91 | 91 | } |
| 92 | - catch(BaseException $e) |
|
| 92 | + catch (BaseException $e) |
|
| 93 | 93 | { |
| 94 | 94 | echo self::createInfo($e)->toString(); |
| 95 | 95 | } |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | { |
| 105 | 105 | throw new BaseException(''); |
| 106 | 106 | } |
| 107 | - catch(BaseException $e) |
|
| 107 | + catch (BaseException $e) |
|
| 108 | 108 | { |
| 109 | 109 | echo '<pre style="background:#fff;font-family:monospace;font-size:14px;color:#444;padding:16px;border:solid 1px #999;border-radius:4px;">'; |
| 110 | 110 | echo self::createInfo($e)->toString(); |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | |
| 23 | 23 | public function __construct(string $class, ?int $code = null, ?Throwable $previous = null) |
| 24 | 24 | { |
| 25 | - if($code === null || $code === 0) { |
|
| 25 | + if ($code === null || $code === 0) { |
|
| 26 | 26 | $code = self::ERROR_CODE; |
| 27 | 27 | } |
| 28 | 28 | |
@@ -126,13 +126,13 @@ discard block |
||
| 126 | 126 | $this->detectNamespace($code); |
| 127 | 127 | $result = $this->detectMatches($code); |
| 128 | 128 | |
| 129 | - if($result === null) { |
|
| 129 | + if ($result === null) { |
|
| 130 | 130 | return; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | $indexes = array_keys($result[0]); |
| 134 | 134 | |
| 135 | - foreach($indexes as $idx) |
|
| 135 | + foreach ($indexes as $idx) |
|
| 136 | 136 | { |
| 137 | 137 | $this->parseResult( |
| 138 | 138 | $result[1][$idx], |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | |
| 152 | 152 | preg_match_all('/(abstract|final)\s+('.$types.')\s+([\sa-z\d\\\\_,]+){|('.$types.')\s+([\sa-z\d\\\\_,]+){/ix', $code, $result, PREG_PATTERN_ORDER); |
| 153 | 153 | |
| 154 | - if(isset($result[0][0])) { |
|
| 154 | + if (isset($result[0][0])) { |
|
| 155 | 155 | return $result; |
| 156 | 156 | } |
| 157 | 157 | |
@@ -163,14 +163,14 @@ discard block |
||
| 163 | 163 | $result = array(); |
| 164 | 164 | preg_match_all('/namespace\s+([^;]+);/ix', $code, $result, PREG_PATTERN_ORDER); |
| 165 | 165 | |
| 166 | - if(isset($result[0][0])) { |
|
| 166 | + if (isset($result[0][0])) { |
|
| 167 | 167 | $this->namespace = trim($result[1][0]); |
| 168 | 168 | } |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | private function parseResult(string $keyword, string $declaration, string $type, string $simpleType, string $simpleDeclaration) : void |
| 172 | 172 | { |
| 173 | - if(empty($keyword)) { |
|
| 173 | + if (empty($keyword)) { |
|
| 174 | 174 | $type = $simpleType; |
| 175 | 175 | $declaration = $simpleDeclaration; |
| 176 | 176 | } |