@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * @see FileHelper_FileFinder |
8 | 8 | */ |
9 | 9 | |
10 | -declare(strict_types = 1); |
|
10 | +declare(strict_types=1); |
|
11 | 11 | |
12 | 12 | namespace AppUtils; |
13 | 13 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | { |
59 | 59 | $real = realpath($path); |
60 | 60 | |
61 | - if($real === false) |
|
61 | + if ($real === false) |
|
62 | 62 | { |
63 | 63 | throw new FileHelper_Exception( |
64 | 64 | 'Target path does not exist', |
@@ -305,22 +305,22 @@ discard block |
||
305 | 305 | return $this->getAll(); |
306 | 306 | } |
307 | 307 | |
308 | - protected function find(string $path, bool $isRoot=false) : void |
|
308 | + protected function find(string $path, bool $isRoot = false) : void |
|
309 | 309 | { |
310 | - if($isRoot) { |
|
310 | + if ($isRoot) { |
|
311 | 311 | $this->found = array(); |
312 | 312 | } |
313 | 313 | |
314 | 314 | $recursive = $this->getBoolOption('recursive'); |
315 | 315 | |
316 | 316 | $d = new \DirectoryIterator($path); |
317 | - foreach($d as $item) |
|
317 | + foreach ($d as $item) |
|
318 | 318 | { |
319 | 319 | $pathname = $item->getPathname(); |
320 | 320 | |
321 | - if($item->isDir()) |
|
321 | + if ($item->isDir()) |
|
322 | 322 | { |
323 | - if($recursive && !$item->isDot()) { |
|
323 | + if ($recursive && !$item->isDot()) { |
|
324 | 324 | $this->find($pathname); |
325 | 325 | } |
326 | 326 | |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | |
330 | 330 | $file = $this->filterFile($pathname); |
331 | 331 | |
332 | - if($file !== null) |
|
332 | + if ($file !== null) |
|
333 | 333 | { |
334 | 334 | $this->found[] = $file; |
335 | 335 | } |
@@ -342,23 +342,23 @@ discard block |
||
342 | 342 | |
343 | 343 | $extension = FileHelper::getExtension($path); |
344 | 344 | |
345 | - if(!$this->filterExclusion($extension)) { |
|
345 | + if (!$this->filterExclusion($extension)) { |
|
346 | 346 | return null; |
347 | 347 | } |
348 | 348 | |
349 | 349 | $path = $this->filterPath($path); |
350 | 350 | |
351 | - if($this->getOption('strip-extensions') === true) |
|
351 | + if ($this->getOption('strip-extensions') === true) |
|
352 | 352 | { |
353 | 353 | $path = str_replace('.'.$extension, '', $path); |
354 | 354 | } |
355 | 355 | |
356 | - if($path === '') { |
|
356 | + if ($path === '') { |
|
357 | 357 | return null; |
358 | 358 | } |
359 | 359 | |
360 | 360 | $replace = $this->getOption('slash-replacement'); |
361 | - if(!empty($replace)) { |
|
361 | + if (!empty($replace)) { |
|
362 | 362 | $path = str_replace('/', $replace, $path); |
363 | 363 | } |
364 | 364 | |
@@ -377,15 +377,15 @@ discard block |
||
377 | 377 | $include = $this->getOption(self::OPTION_INCLUDE_EXTENSIONS); |
378 | 378 | $exclude = $this->getOption(self::OPTION_EXCLUDE_EXTENSIONS); |
379 | 379 | |
380 | - if(!empty($include)) |
|
380 | + if (!empty($include)) |
|
381 | 381 | { |
382 | - if(!in_array($extension, $include)) { |
|
382 | + if (!in_array($extension, $include)) { |
|
383 | 383 | return false; |
384 | 384 | } |
385 | 385 | } |
386 | - else if(!empty($exclude)) |
|
386 | + else if (!empty($exclude)) |
|
387 | 387 | { |
388 | - if(in_array($extension, $exclude)) { |
|
388 | + if (in_array($extension, $exclude)) { |
|
389 | 389 | return false; |
390 | 390 | } |
391 | 391 | } |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | */ |
402 | 402 | protected function filterPath(string $path) : string |
403 | 403 | { |
404 | - switch($this->getStringOption(self::OPTION_PATHMODE)) |
|
404 | + switch ($this->getStringOption(self::OPTION_PATHMODE)) |
|
405 | 405 | { |
406 | 406 | case self::PATH_MODE_STRIP: |
407 | 407 | return basename($path); |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | { |
106 | 106 | $name = $this->getName(); |
107 | 107 | |
108 | - if($this->info->hasNamespace()) { |
|
108 | + if ($this->info->hasNamespace()) { |
|
109 | 109 | $name = $this->info->getNamespace().'\\'.$this->name; |
110 | 110 | } |
111 | 111 | |
@@ -160,12 +160,12 @@ discard block |
||
160 | 160 | $parts[] = 'class'; |
161 | 161 | $parts[] = $this->getName(); |
162 | 162 | |
163 | - if(!empty($this->extends)) { |
|
163 | + if (!empty($this->extends)) { |
|
164 | 164 | $parts[] = 'extends'; |
165 | 165 | $parts[] = $this->extends; |
166 | 166 | } |
167 | 167 | |
168 | - if(!empty($this->implements)) { |
|
168 | + if (!empty($this->implements)) { |
|
169 | 169 | $parts[] = 'implements'; |
170 | 170 | $parts[] = implode(', ', $this->implements); |
171 | 171 | } |
@@ -184,9 +184,9 @@ discard block |
||
184 | 184 | |
185 | 185 | protected function analyzeCode() : void |
186 | 186 | { |
187 | - if($this->keyword == 'abstract') { |
|
187 | + if ($this->keyword == 'abstract') { |
|
188 | 188 | $this->abstract = true; |
189 | - } else if($this->keyword == 'final') { |
|
189 | + } else if ($this->keyword == 'final') { |
|
190 | 190 | $this->final = true; |
191 | 191 | } |
192 | 192 | |
@@ -203,16 +203,16 @@ discard block |
||
203 | 203 | |
204 | 204 | $tokenName = 'none'; |
205 | 205 | |
206 | - foreach($parts as $part) |
|
206 | + foreach ($parts as $part) |
|
207 | 207 | { |
208 | 208 | $part = str_replace(',', '', $part); |
209 | 209 | $part = trim($part); |
210 | - if(empty($part)) { |
|
210 | + if (empty($part)) { |
|
211 | 211 | continue; |
212 | 212 | } |
213 | 213 | |
214 | 214 | $name = strtolower($part); |
215 | - if($name == 'extends' || $name == 'implements') { |
|
215 | + if ($name == 'extends' || $name == 'implements') { |
|
216 | 216 | $tokenName = $name; |
217 | 217 | continue; |
218 | 218 | } |
@@ -222,13 +222,13 @@ discard block |
||
222 | 222 | |
223 | 223 | $this->implements = $tokens['implements']; |
224 | 224 | |
225 | - if(!empty($this->implements)) { |
|
225 | + if (!empty($this->implements)) { |
|
226 | 226 | usort($this->implements, function(string $a, string $b) { |
227 | 227 | return strnatcasecmp($a, $b); |
228 | 228 | }); |
229 | 229 | } |
230 | 230 | |
231 | - if(!empty($tokens['extends'])) { |
|
231 | + if (!empty($tokens['extends'])) { |
|
232 | 232 | $this->extends = $tokens['extends'][0]; |
233 | 233 | } |
234 | 234 | } |
@@ -104,11 +104,11 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public static function fromClosure(Closure $closure, $origin) : NamedClosure |
106 | 106 | { |
107 | - if(is_object($origin)) |
|
107 | + if (is_object($origin)) |
|
108 | 108 | { |
109 | 109 | $description = get_class($origin); |
110 | 110 | } |
111 | - else if(is_array($origin)) |
|
111 | + else if (is_array($origin)) |
|
112 | 112 | { |
113 | 113 | $description = ConvertHelper::callback2string($origin); |
114 | 114 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * @param string|object $origin Optional origin. If not specified, the object and method name are used instead. |
127 | 127 | * @return NamedClosure |
128 | 128 | */ |
129 | - public static function fromObject(object $object, string $method, $origin='') : NamedClosure |
|
129 | + public static function fromObject(object $object, string $method, $origin = '') : NamedClosure |
|
130 | 130 | { |
131 | 131 | return self::fromArray(array($object, $method), $origin); |
132 | 132 | } |
@@ -136,11 +136,11 @@ discard block |
||
136 | 136 | * @param string|object $origin |
137 | 137 | * @return NamedClosure |
138 | 138 | */ |
139 | - public static function fromArray(array $callback, $origin='') : NamedClosure |
|
139 | + public static function fromArray(array $callback, $origin = '') : NamedClosure |
|
140 | 140 | { |
141 | - if(empty($origin)) { |
|
141 | + if (empty($origin)) { |
|
142 | 142 | $origin = ConvertHelper::callback2string($callback); |
143 | - } else if(is_object($origin)) { |
|
143 | + } else if (is_object($origin)) { |
|
144 | 144 | $origin = get_class($origin); |
145 | 145 | } |
146 | 146 |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * @see RGBAColor::ERROR_INVALID_COLOR_COMPONENT |
72 | 72 | * @see RGBAColor::ERROR_INVALID_PERCENTAGE_VALUE |
73 | 73 | */ |
74 | - public function __construct(float $red, float $green, float $blue, float $alpha=100) |
|
74 | + public function __construct(float $red, float $green, float $blue, float $alpha = 100) |
|
75 | 75 | { |
76 | 76 | $this->setColorPercentage(self::COMPONENT_RED, $red); |
77 | 77 | $this->setColorPercentage(self:: COMPONENT_GREEN, $green); |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | */ |
163 | 163 | public function setTransparency(float $transparency) : RGBAColor |
164 | 164 | { |
165 | - return $this->setColorPercentage(self::COMPONENT_ALPHA, 100-$transparency); |
|
165 | + return $this->setColorPercentage(self::COMPONENT_ALPHA, 100 - $transparency); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | /** |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | { |
283 | 283 | $this->requireValidComponent($name); |
284 | 284 | |
285 | - if($percentage >= 0 && $percentage <= 100) |
|
285 | + if ($percentage >= 0 && $percentage <= 100) |
|
286 | 286 | { |
287 | 287 | $this->color[$name] = $percentage; |
288 | 288 | return $this; |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | { |
313 | 313 | $this->requireValidComponent($name); |
314 | 314 | |
315 | - if($value >= 0 && $value <= 255) |
|
315 | + if ($value >= 0 && $value <= 255) |
|
316 | 316 | { |
317 | 317 | // Convert the value to a percentage for the internal storage. |
318 | 318 | $percentage = $value * 100 / 255; |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | */ |
338 | 338 | private function requireValidComponent(string $name) : void |
339 | 339 | { |
340 | - if(in_array($name, self::COLOR_COMPONENTS)) |
|
340 | + if (in_array($name, self::COLOR_COMPONENTS)) |
|
341 | 341 | { |
342 | 342 | return; |
343 | 343 | } |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | { |
400 | 400 | $key = strval($offset); |
401 | 401 | |
402 | - if(isset($this->color[$key])) |
|
402 | + if (isset($this->color[$key])) |
|
403 | 403 | { |
404 | 404 | return $this->color[$key]; |
405 | 405 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | */ |
69 | 69 | protected function __construct($subject) |
70 | 70 | { |
71 | - if(is_array($subject)) |
|
71 | + if (is_array($subject)) |
|
72 | 72 | { |
73 | 73 | $this->parseSerialized($subject); |
74 | 74 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | */ |
127 | 127 | public function getPrevious() : ConvertHelper_ThrowableInfo |
128 | 128 | { |
129 | - if(isset($this->previous)) { |
|
129 | + if (isset($this->previous)) { |
|
130 | 130 | return $this->previous; |
131 | 131 | } |
132 | 132 | |
@@ -151,18 +151,18 @@ discard block |
||
151 | 151 | |
152 | 152 | $string = 'Exception'; |
153 | 153 | |
154 | - if($this->hasCode()) { |
|
154 | + if ($this->hasCode()) { |
|
155 | 155 | $string .= ' #'.$this->code; |
156 | 156 | } |
157 | 157 | |
158 | 158 | $string .= ': '.$this->getMessage().PHP_EOL; |
159 | 159 | |
160 | - foreach($calls as $call) |
|
160 | + foreach ($calls as $call) |
|
161 | 161 | { |
162 | 162 | $string .= $call->toString().PHP_EOL; |
163 | 163 | } |
164 | 164 | |
165 | - if($this->hasPrevious()) |
|
165 | + if ($this->hasPrevious()) |
|
166 | 166 | { |
167 | 167 | $string .= PHP_EOL.PHP_EOL. |
168 | 168 | 'Previous error:'.PHP_EOL.PHP_EOL. |
@@ -253,11 +253,11 @@ discard block |
||
253 | 253 | 'previous' => null, |
254 | 254 | ); |
255 | 255 | |
256 | - if($this->hasPrevious()) { |
|
257 | - $result['previous'] = $this->previous->serialize(); |
|
256 | + if ($this->hasPrevious()) { |
|
257 | + $result['previous'] = $this->previous->serialize(); |
|
258 | 258 | } |
259 | 259 | |
260 | - foreach($this->calls as $call) |
|
260 | + foreach ($this->calls as $call) |
|
261 | 261 | { |
262 | 262 | $result['calls'][] = $call->serialize(); |
263 | 263 | } |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | public function getFolderDepth() : int |
287 | 287 | { |
288 | 288 | $depth = $this->getOption('folder-depth'); |
289 | - if(!empty($depth)) { |
|
289 | + if (!empty($depth)) { |
|
290 | 290 | return $depth; |
291 | 291 | } |
292 | 292 | |
@@ -340,12 +340,12 @@ discard block |
||
340 | 340 | |
341 | 341 | $this->setOptions($serialized['options']); |
342 | 342 | |
343 | - if(!empty($serialized['previous'])) |
|
343 | + if (!empty($serialized['previous'])) |
|
344 | 344 | { |
345 | 345 | $this->previous = ConvertHelper_ThrowableInfo::fromSerialized($serialized['previous']); |
346 | 346 | } |
347 | 347 | |
348 | - foreach($serialized['calls'] as $def) |
|
348 | + foreach ($serialized['calls'] as $def) |
|
349 | 349 | { |
350 | 350 | $this->calls[] = ConvertHelper_ThrowableInfo_Call::fromSerialized($this, $def); |
351 | 351 | } |
@@ -357,16 +357,16 @@ discard block |
||
357 | 357 | $this->message = $e->getMessage(); |
358 | 358 | $this->code = $e->getCode(); |
359 | 359 | |
360 | - if(!isset($_REQUEST['REQUEST_URI'])) { |
|
360 | + if (!isset($_REQUEST['REQUEST_URI'])) { |
|
361 | 361 | $this->context = self::CONTEXT_COMMAND_LINE; |
362 | 362 | } |
363 | 363 | |
364 | 364 | $previous = $e->getPrevious(); |
365 | - if(!empty($previous)) { |
|
365 | + if (!empty($previous)) { |
|
366 | 366 | $this->previous = ConvertHelper::throwable2info($previous); |
367 | 367 | } |
368 | 368 | |
369 | - if(isset($_SERVER['REQUEST_URI'])) { |
|
369 | + if (isset($_SERVER['REQUEST_URI'])) { |
|
370 | 370 | $this->referer = $_SERVER['REQUEST_URI']; |
371 | 371 | } |
372 | 372 | |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | |
381 | 381 | $idx = 1; |
382 | 382 | |
383 | - foreach($trace as $entry) |
|
383 | + foreach ($trace as $entry) |
|
384 | 384 | { |
385 | 385 | $this->calls[] = ConvertHelper_ThrowableInfo_Call::fromTrace($this, $idx, $entry); |
386 | 386 | |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | * @return string |
416 | 416 | * @throws ConvertHelper_Exception |
417 | 417 | */ |
418 | - public function renderErrorMessage(bool $withDeveloperInfo=false) : string |
|
418 | + public function renderErrorMessage(bool $withDeveloperInfo = false) : string |
|
419 | 419 | { |
420 | 420 | $finalCall = $this->getFinalCall(); |
421 | 421 | |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | ->t('Message:') |
428 | 428 | ->add($this->getMessage()); |
429 | 429 | |
430 | - if($withDeveloperInfo) |
|
430 | + if ($withDeveloperInfo) |
|
431 | 431 | { |
432 | 432 | $message |
433 | 433 | ->eol() |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | ->add($finalCall->toString()); |
436 | 436 | } |
437 | 437 | |
438 | - if($withDeveloperInfo && $this->hasDetails()) |
|
438 | + if ($withDeveloperInfo && $this->hasDetails()) |
|
439 | 439 | { |
440 | 440 | $message |
441 | 441 | ->t('Developer details:') |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | |
446 | 446 | $previous = $this->getPrevious(); |
447 | 447 | |
448 | - if($previous !== null) |
|
448 | + if ($previous !== null) |
|
449 | 449 | { |
450 | 450 | $message |
451 | 451 | ->eol() |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | |
461 | 461 | public function getDetails() : string |
462 | 462 | { |
463 | - if($this->exception instanceof BaseException) |
|
463 | + if ($this->exception instanceof BaseException) |
|
464 | 464 | { |
465 | 465 | return $this->exception->getDetails(); |
466 | 466 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public static function getPresetsManager() : RGBAColor_PresetsManager |
40 | 40 | { |
41 | - if(!isset(self::$presets)) |
|
41 | + if (!isset(self::$presets)) |
|
42 | 42 | { |
43 | 43 | self::$presets = new RGBAColor_PresetsManager(); |
44 | 44 | } |
@@ -60,14 +60,14 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public static function createAuto($subject) : RGBAColor |
62 | 62 | { |
63 | - if($subject instanceof RGBAColor) |
|
63 | + if ($subject instanceof RGBAColor) |
|
64 | 64 | { |
65 | 65 | return $subject; |
66 | 66 | } |
67 | 67 | |
68 | - if(is_array($subject)) |
|
68 | + if (is_array($subject)) |
|
69 | 69 | { |
70 | - if(RGBAColor_Converter::isColorArray($subject)) |
|
70 | + if (RGBAColor_Converter::isColorArray($subject)) |
|
71 | 71 | { |
72 | 72 | return self::createFromColor($subject); |
73 | 73 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | return self::createFromIndexedColor($subject); |
76 | 76 | } |
77 | 77 | |
78 | - if(is_string($subject)) |
|
78 | + if (is_string($subject)) |
|
79 | 79 | { |
80 | 80 | return self::createFromHEX($subject); |
81 | 81 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public static function createFromColor(array $color) : RGBAColor |
118 | 118 | { |
119 | - if(!isset($color[RGBAColor::COMPONENT_ALPHA])) |
|
119 | + if (!isset($color[RGBAColor::COMPONENT_ALPHA])) |
|
120 | 120 | { |
121 | 121 | $color[RGBAColor::COMPONENT_ALPHA] = 255; |
122 | 122 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | $values = array_values($color); |
164 | 164 | $amountKeys = count($values); |
165 | 165 | |
166 | - if($amountKeys === 3) |
|
166 | + if ($amountKeys === 3) |
|
167 | 167 | { |
168 | 168 | return self::createFromColor(array( |
169 | 169 | RGBAColor::COMPONENT_RED => $color[0], |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | )); |
173 | 173 | } |
174 | 174 | |
175 | - if($amountKeys === 4) |
|
175 | + if ($amountKeys === 4) |
|
176 | 176 | { |
177 | 177 | return self::createFromColor(array( |
178 | 178 | RGBAColor::COMPONENT_RED => $color[0], |
@@ -39,9 +39,9 @@ |
||
39 | 39 | { |
40 | 40 | $parts = array(RGBAColor::COMPONENT_RED, RGBAColor::COMPONENT_GREEN, RGBAColor::COMPONENT_BLUE); |
41 | 41 | |
42 | - foreach($parts as $part) |
|
42 | + foreach ($parts as $part) |
|
43 | 43 | { |
44 | - if($sourceColor->getColorValue($part) !== $targetColor->getColorValue($part)) |
|
44 | + if ($sourceColor->getColorValue($part) !== $targetColor->getColorValue($part)) |
|
45 | 45 | { |
46 | 46 | return false; |
47 | 47 | } |
@@ -60,14 +60,14 @@ discard block |
||
60 | 60 | */ |
61 | 61 | private function init() : void |
62 | 62 | { |
63 | - if(self::$initialized === true) |
|
63 | + if (self::$initialized === true) |
|
64 | 64 | { |
65 | 65 | return; |
66 | 66 | } |
67 | 67 | |
68 | 68 | $this |
69 | 69 | ->registerGlobalPreset(self::COLOR_WHITE, 255, 255, 255, 255) |
70 | - ->registerGlobalPreset(self::COLOR_BLACK, 0,0,0, 255) |
|
70 | + ->registerGlobalPreset(self::COLOR_BLACK, 0, 0, 0, 255) |
|
71 | 71 | ->registerGlobalPreset(self::COLOR_TRANSPARENT, 0, 0, 0, 0); |
72 | 72 | } |
73 | 73 | |
@@ -80,12 +80,12 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function getPreset(string $name) : array |
82 | 82 | { |
83 | - if(isset($this->customPresets[$name])) |
|
83 | + if (isset($this->customPresets[$name])) |
|
84 | 84 | { |
85 | 85 | return $this->customPresets[$name]; |
86 | 86 | } |
87 | 87 | |
88 | - if(isset(self::$globalPresets[$name])) |
|
88 | + if (isset(self::$globalPresets[$name])) |
|
89 | 89 | { |
90 | 90 | return self::$globalPresets[$name]; |
91 | 91 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | { |
114 | 114 | $this->requireNotGlobal($name); |
115 | 115 | |
116 | - if(!isset(self::$globalPresets[$name])) |
|
116 | + if (!isset(self::$globalPresets[$name])) |
|
117 | 117 | { |
118 | 118 | self::$globalPresets[$name] = array( |
119 | 119 | RGBAColor::COMPONENT_RED => $red, |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | ); |
136 | 136 | } |
137 | 137 | |
138 | - public function registerPreset(string $name, int $red, int $green, int $blue, int $alpha=255) : RGBAColor_PresetsManager |
|
138 | + public function registerPreset(string $name, int $red, int $green, int $blue, int $alpha = 255) : RGBAColor_PresetsManager |
|
139 | 139 | { |
140 | 140 | $this->requireNotGlobal($name); |
141 | 141 | |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | |
152 | 152 | private function requireNotGlobal(string $name) : void |
153 | 153 | { |
154 | - if(!isset(self::$globalPresets[$name])) |
|
154 | + if (!isset(self::$globalPresets[$name])) |
|
155 | 155 | { |
156 | 156 | return; |
157 | 157 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public static function requireValidColorArray(array $color) : void |
50 | 50 | { |
51 | - if(self::isColorArray($color)) |
|
51 | + if (self::isColorArray($color)) |
|
52 | 52 | { |
53 | 53 | return; |
54 | 54 | } |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | RGBAColor::COMPONENT_BLUE |
81 | 81 | ); |
82 | 82 | |
83 | - foreach($keys as $key) |
|
83 | + foreach ($keys as $key) |
|
84 | 84 | { |
85 | - if(!isset($color[$key])) |
|
85 | + if (!isset($color[$key])) |
|
86 | 86 | { |
87 | 87 | return false; |
88 | 88 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | self::int2hex($color[RGBAColor::COMPONENT_GREEN]). |
105 | 105 | self::int2hex($color[RGBAColor::COMPONENT_BLUE]); |
106 | 106 | |
107 | - if(isset($color[RGBAColor::COMPONENT_ALPHA]) && $color[RGBAColor::COMPONENT_ALPHA] < 255) |
|
107 | + if (isset($color[RGBAColor::COMPONENT_ALPHA]) && $color[RGBAColor::COMPONENT_ALPHA] < 255) |
|
108 | 108 | { |
109 | 109 | $hex .= self::int2hex($color[RGBAColor::COMPONENT_ALPHA]); |
110 | 110 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | private static function int2hex(int $int) : string |
125 | 125 | { |
126 | 126 | $str = dechex($int); |
127 | - if(strlen($str) === 1) |
|
127 | + if (strlen($str) === 1) |
|
128 | 128 | { |
129 | 129 | $str = $str.$str; |
130 | 130 | } |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | */ |
144 | 144 | public static function color2readable(RGBAColor $color) : string |
145 | 145 | { |
146 | - if($color->hasTransparency()) |
|
146 | + if ($color->hasTransparency()) |
|
147 | 147 | { |
148 | 148 | return sprintf( |
149 | 149 | 'RGBA(%s %s %s %s)', |
@@ -207,11 +207,11 @@ discard block |
||
207 | 207 | $hex = strtoupper($hex); |
208 | 208 | $length = strlen($hex); |
209 | 209 | |
210 | - if($length === 3) |
|
210 | + if ($length === 3) |
|
211 | 211 | { |
212 | 212 | return self::parseHEX3($hex); |
213 | 213 | } |
214 | - else if($length === 6) |
|
214 | + else if ($length === 6) |
|
215 | 215 | { |
216 | 216 | return self::parseHEX6($hex); |
217 | 217 | } |