@@ -114,7 +114,7 @@ |
||
| 114 | 114 | // Under GitHub Actions, we can set an ENV var named 'DB' |
| 115 | 115 | // so that we can test against multiple databases. |
| 116 | 116 | if ($group = getenv('DB')) { |
| 117 | - if (! empty(self::$dbConfig[$group])) { |
|
| 117 | + if (!empty(self::$dbConfig[$group])) { |
|
| 118 | 118 | $config['tests'] = self::$dbConfig[$group]; |
| 119 | 119 | } |
| 120 | 120 | } |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | ]; |
| 28 | 28 | |
| 29 | 29 | // Return a faked entity |
| 30 | - public function fake(Generator &$faker) |
|
| 30 | + public function fake(Generator & $faker) |
|
| 31 | 31 | { |
| 32 | 32 | return (object) [ |
| 33 | 33 | 'name' => $faker->ipv4, |
@@ -4,8 +4,8 @@ |
||
| 4 | 4 | use CodeIgniter\CLI\CLI; |
| 5 | 5 | |
| 6 | 6 | return [ |
| 7 | - 'foo' => 'The command will use this as foo.', |
|
| 8 | - 'bar' => 'The command will use this as bar.', |
|
| 9 | - 'baz' => 'The baz is here.', |
|
| 10 | - 'bas' => CLI::color('bas', 'green') . (new App())->baseURL, |
|
| 7 | + 'foo' => 'The command will use this as foo.', |
|
| 8 | + 'bar' => 'The command will use this as bar.', |
|
| 9 | + 'baz' => 'The baz is here.', |
|
| 10 | + 'bas' => CLI::color('bas', 'green') . (new App())->baseURL, |
|
| 11 | 11 | ]; |
@@ -9,13 +9,13 @@ |
||
| 9 | 9 | * the LICENSE file that was distributed with this source code. |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -if (! function_exists('autoload_foo')) { |
|
| 12 | +if (!function_exists('autoload_foo')) { |
|
| 13 | 13 | function autoload_foo(): string |
| 14 | 14 | { |
| 15 | 15 | return 'I am autoloaded by Autoloader through $files!'; |
| 16 | 16 | } |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | -if (! defined('AUTOLOAD_CONSTANT')) { |
|
| 19 | +if (!defined('AUTOLOAD_CONSTANT')) { |
|
| 20 | 20 | define('AUTOLOAD_CONSTANT', 'foo'); |
| 21 | 21 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | // We should never see this, so can't test it |
| 51 | 51 | // @codeCoverageIgnoreStart |
| 52 | - if (! (extension_loaded('imagick') || class_exists('Imagick'))) { |
|
| 52 | + if (!(extension_loaded('imagick') || class_exists('Imagick'))) { |
|
| 53 | 53 | throw ImageException::forMissingExtension('IMAGICK'); |
| 54 | 54 | } |
| 55 | 55 | // @codeCoverageIgnoreEnd |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | public function _resize(bool $maintainRatio = false) |
| 66 | 66 | { |
| 67 | - $source = ! empty($this->resource) ? $this->resource : $this->image()->getPathname(); |
|
| 67 | + $source = !empty($this->resource) ? $this->resource : $this->image()->getPathname(); |
|
| 68 | 68 | $destination = $this->getResourcePath(); |
| 69 | 69 | |
| 70 | 70 | $escape = '\\'; |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | public function _crop() |
| 93 | 93 | { |
| 94 | - $source = ! empty($this->resource) ? $this->resource : $this->image()->getPathname(); |
|
| 94 | + $source = !empty($this->resource) ? $this->resource : $this->image()->getPathname(); |
|
| 95 | 95 | $destination = $this->getResourcePath(); |
| 96 | 96 | |
| 97 | 97 | $extent = ' '; |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | { |
| 119 | 119 | $angle = '-rotate ' . $angle; |
| 120 | 120 | |
| 121 | - $source = ! empty($this->resource) ? $this->resource : $this->image()->getPathname(); |
|
| 121 | + $source = !empty($this->resource) ? $this->resource : $this->image()->getPathname(); |
|
| 122 | 122 | $destination = $this->getResourcePath(); |
| 123 | 123 | |
| 124 | 124 | $action = ' ' . $angle . ' ' . escapeshellarg($source) . ' ' . escapeshellarg($destination); |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | { |
| 140 | 140 | $flatten = "-background 'rgb({$red},{$green},{$blue})' -flatten"; |
| 141 | 141 | |
| 142 | - $source = ! empty($this->resource) ? $this->resource : $this->image()->getPathname(); |
|
| 142 | + $source = !empty($this->resource) ? $this->resource : $this->image()->getPathname(); |
|
| 143 | 143 | $destination = $this->getResourcePath(); |
| 144 | 144 | |
| 145 | 145 | $action = ' ' . $flatten . ' ' . escapeshellarg($source) . ' ' . escapeshellarg($destination); |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | { |
| 161 | 161 | $angle = $direction === 'horizontal' ? '-flop' : '-flip'; |
| 162 | 162 | |
| 163 | - $source = ! empty($this->resource) ? $this->resource : $this->image()->getPathname(); |
|
| 163 | + $source = !empty($this->resource) ? $this->resource : $this->image()->getPathname(); |
|
| 164 | 164 | $destination = $this->getResourcePath(); |
| 165 | 165 | |
| 166 | 166 | $action = ' ' . $angle . ' ' . escapeshellarg($source) . ' ' . escapeshellarg($destination); |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | $this->supportedFormatCheck(); |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | - if (! preg_match('/convert$/i', $this->config->libraryPath)) { |
|
| 204 | + if (!preg_match('/convert$/i', $this->config->libraryPath)) { |
|
| 205 | 205 | $this->config->libraryPath = rtrim($this->config->libraryPath, '/') . '/convert'; |
| 206 | 206 | } |
| 207 | 207 | |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | { |
| 317 | 317 | switch ($this->image()->imageType) { |
| 318 | 318 | case IMAGETYPE_WEBP: |
| 319 | - if (! in_array('WEBP', Imagick::queryFormats(), true)) { |
|
| 319 | + if (!in_array('WEBP', Imagick::queryFormats(), true)) { |
|
| 320 | 320 | throw ImageException::forInvalidImageCreate(lang('images.webpNotSupported')); |
| 321 | 321 | } |
| 322 | 322 | break; |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | // Font |
| 350 | - if (! empty($options['fontPath'])) { |
|
| 350 | + if (!empty($options['fontPath'])) { |
|
| 351 | 351 | $cmd .= " -font '{$options['fontPath']}'"; |
| 352 | 352 | } |
| 353 | 353 | |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | // Text |
| 406 | 406 | $cmd .= " -annotate 0 '{$text}'"; |
| 407 | 407 | |
| 408 | - $source = ! empty($this->resource) ? $this->resource : $this->image()->getPathname(); |
|
| 408 | + $source = !empty($this->resource) ? $this->resource : $this->image()->getPathname(); |
|
| 409 | 409 | $destination = $this->getResourcePath(); |
| 410 | 410 | |
| 411 | 411 | $cmd = " '{$source}' {$cmd} '{$destination}'"; |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | { |
| 31 | 31 | parent::__construct($config); |
| 32 | 32 | |
| 33 | - if (! extension_loaded('gd')) { |
|
| 33 | + if (!extension_loaded('gd')) { |
|
| 34 | 34 | throw ImageException::forMissingExtension('GD'); // @codeCoverageIgnore |
| 35 | 35 | } |
| 36 | 36 | } |
@@ -227,41 +227,41 @@ discard block |
||
| 227 | 227 | |
| 228 | 228 | switch ($this->image()->imageType) { |
| 229 | 229 | case IMAGETYPE_GIF: |
| 230 | - if (! function_exists('imagegif')) { |
|
| 230 | + if (!function_exists('imagegif')) { |
|
| 231 | 231 | throw ImageException::forInvalidImageCreate(lang('Images.gifNotSupported')); |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | - if (! @imagegif($this->resource, $target)) { |
|
| 234 | + if (!@imagegif($this->resource, $target)) { |
|
| 235 | 235 | throw ImageException::forSaveFailed(); |
| 236 | 236 | } |
| 237 | 237 | break; |
| 238 | 238 | |
| 239 | 239 | case IMAGETYPE_JPEG: |
| 240 | - if (! function_exists('imagejpeg')) { |
|
| 240 | + if (!function_exists('imagejpeg')) { |
|
| 241 | 241 | throw ImageException::forInvalidImageCreate(lang('Images.jpgNotSupported')); |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | - if (! @imagejpeg($this->resource, $target, $quality)) { |
|
| 244 | + if (!@imagejpeg($this->resource, $target, $quality)) { |
|
| 245 | 245 | throw ImageException::forSaveFailed(); |
| 246 | 246 | } |
| 247 | 247 | break; |
| 248 | 248 | |
| 249 | 249 | case IMAGETYPE_PNG: |
| 250 | - if (! function_exists('imagepng')) { |
|
| 250 | + if (!function_exists('imagepng')) { |
|
| 251 | 251 | throw ImageException::forInvalidImageCreate(lang('Images.pngNotSupported')); |
| 252 | 252 | } |
| 253 | 253 | |
| 254 | - if (! @imagepng($this->resource, $target)) { |
|
| 254 | + if (!@imagepng($this->resource, $target)) { |
|
| 255 | 255 | throw ImageException::forSaveFailed(); |
| 256 | 256 | } |
| 257 | 257 | break; |
| 258 | 258 | |
| 259 | 259 | case IMAGETYPE_WEBP: |
| 260 | - if (! function_exists('imagewebp')) { |
|
| 260 | + if (!function_exists('imagewebp')) { |
|
| 261 | 261 | throw ImageException::forInvalidImageCreate(lang('Images.webpNotSupported')); |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | - if (! @imagewebp($this->resource, $target)) { |
|
| 264 | + if (!@imagewebp($this->resource, $target)) { |
|
| 265 | 265 | throw ImageException::forSaveFailed(); |
| 266 | 266 | } |
| 267 | 267 | break; |
@@ -330,28 +330,28 @@ discard block |
||
| 330 | 330 | { |
| 331 | 331 | switch ($imageType) { |
| 332 | 332 | case IMAGETYPE_GIF: |
| 333 | - if (! function_exists('imagecreatefromgif')) { |
|
| 333 | + if (!function_exists('imagecreatefromgif')) { |
|
| 334 | 334 | throw ImageException::forInvalidImageCreate(lang('Images.gifNotSupported')); |
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | return imagecreatefromgif($path); |
| 338 | 338 | |
| 339 | 339 | case IMAGETYPE_JPEG: |
| 340 | - if (! function_exists('imagecreatefromjpeg')) { |
|
| 340 | + if (!function_exists('imagecreatefromjpeg')) { |
|
| 341 | 341 | throw ImageException::forInvalidImageCreate(lang('Images.jpgNotSupported')); |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | return imagecreatefromjpeg($path); |
| 345 | 345 | |
| 346 | 346 | case IMAGETYPE_PNG: |
| 347 | - if (! function_exists('imagecreatefrompng')) { |
|
| 347 | + if (!function_exists('imagecreatefrompng')) { |
|
| 348 | 348 | throw ImageException::forInvalidImageCreate(lang('Images.pngNotSupported')); |
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | return imagecreatefrompng($path); |
| 352 | 352 | |
| 353 | 353 | case IMAGETYPE_WEBP: |
| 354 | - if (! function_exists('imagecreatefromwebp')) { |
|
| 354 | + if (!function_exists('imagecreatefromwebp')) { |
|
| 355 | 355 | throw ImageException::forInvalidImageCreate(lang('Images.webpNotSupported')); |
| 356 | 356 | } |
| 357 | 357 | |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | // Set font width and height |
| 386 | 386 | // These are calculated differently depending on |
| 387 | 387 | // whether we are using the true type font or not |
| 388 | - if (! empty($options['fontPath'])) { |
|
| 388 | + if (!empty($options['fontPath'])) { |
|
| 389 | 389 | if (function_exists('imagettfbbox')) { |
| 390 | 390 | $temp = imagettfbbox($options['fontSize'], 0, $options['fontPath'], $text); |
| 391 | 391 | $temp = $temp[2] - $temp[0]; |
@@ -470,7 +470,7 @@ discard block |
||
| 470 | 470 | $yAxis = $isShadow ? $options['yShadow'] : $options['yAxis']; |
| 471 | 471 | |
| 472 | 472 | // Add the shadow to the source image |
| 473 | - if (! empty($options['fontPath'])) { |
|
| 473 | + if (!empty($options['fontPath'])) { |
|
| 474 | 474 | // We have to add fontheight because imagettftext locates the bottom left corner, not top-left corner. |
| 475 | 475 | imagettftext($src, $options['fontSize'], 0, (int) $xAxis, (int) ($yAxis + $options['fontheight']), $color, $options['fontPath'], $text); |
| 476 | 476 | } else { |
@@ -188,12 +188,12 @@ discard block |
||
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | // Verify the loaded image is an Image instance |
| 191 | - if (! $this->image instanceof Image) { |
|
| 191 | + if (!$this->image instanceof Image) { |
|
| 192 | 192 | throw ImageException::forInvalidPath(); |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | // File::__construct has verified the file exists - make sure it is an image |
| 196 | - if (! is_int($this->image->imageType)) { |
|
| 196 | + if (!is_int($this->image->imageType)) { |
|
| 197 | 197 | throw ImageException::forFileNotSupported(); |
| 198 | 198 | } |
| 199 | 199 | |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | 270.0, |
| 316 | 316 | ]; |
| 317 | 317 | |
| 318 | - if (! in_array($angle, $degs, true)) { |
|
| 318 | + if (!in_array($angle, $degs, true)) { |
|
| 319 | 319 | throw ImageException::forMissingAngle(); |
| 320 | 320 | } |
| 321 | 321 | |
@@ -507,7 +507,7 @@ discard block |
||
| 507 | 507 | */ |
| 508 | 508 | public function getEXIF(?string $key = null, bool $silent = false) |
| 509 | 509 | { |
| 510 | - if (! function_exists('exif_read_data')) { |
|
| 510 | + if (!function_exists('exif_read_data')) { |
|
| 511 | 511 | if ($silent) { |
| 512 | 512 | return null; |
| 513 | 513 | } |
@@ -723,7 +723,7 @@ discard block |
||
| 723 | 723 | */ |
| 724 | 724 | protected function reproportion() |
| 725 | 725 | { |
| 726 | - if (($this->width === 0 && $this->height === 0) || $this->image()->origWidth === 0 || $this->image()->origHeight === 0 || (! ctype_digit((string) $this->width) && ! ctype_digit((string) $this->height)) || ! ctype_digit((string) $this->image()->origWidth) || ! ctype_digit((string) $this->image()->origHeight)) { |
|
| 726 | + if (($this->width === 0 && $this->height === 0) || $this->image()->origWidth === 0 || $this->image()->origHeight === 0 || (!ctype_digit((string) $this->width) && !ctype_digit((string) $this->height)) || !ctype_digit((string) $this->image()->origWidth) || !ctype_digit((string) $this->image()->origHeight)) { |
|
| 727 | 727 | return; |
| 728 | 728 | } |
| 729 | 729 | |
@@ -75,11 +75,11 @@ discard block |
||
| 75 | 75 | throw ImageException::forInvalidFile($targetName); |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - if (! is_dir($targetPath)) { |
|
| 78 | + if (!is_dir($targetPath)) { |
|
| 79 | 79 | mkdir($targetPath, 0755, true); |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - if (! copy($this->getPathname(), "{$targetPath}{$targetName}")) { |
|
| 82 | + if (!copy($this->getPathname(), "{$targetPath}{$targetName}")) { |
|
| 83 | 83 | throw ImageException::forCopyError($targetPath); |
| 84 | 84 | } |
| 85 | 85 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | { |
| 100 | 100 | $path = $this->getPathname(); |
| 101 | 101 | |
| 102 | - if (! $vals = getimagesize($path)) { |
|
| 102 | + if (!$vals = getimagesize($path)) { |
|
| 103 | 103 | throw ImageException::forFileNotSupported(); |
| 104 | 104 | } |
| 105 | 105 | |
@@ -103,11 +103,11 @@ discard block |
||
| 103 | 103 | return $this; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - if (! is_array($this->value)) { |
|
| 106 | + if (!is_array($this->value)) { |
|
| 107 | 107 | $this->value = [$this->value]; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - if (! in_array($value, $this->value, true)) { |
|
| 110 | + if (!in_array($value, $this->value, true)) { |
|
| 111 | 111 | $this->value[] = $value; |
| 112 | 112 | } |
| 113 | 113 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | return $this; |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - if (! is_array($this->value)) { |
|
| 131 | + if (!is_array($this->value)) { |
|
| 132 | 132 | $this->value = [$this->value]; |
| 133 | 133 | } |
| 134 | 134 | |
@@ -151,14 +151,14 @@ discard block |
||
| 151 | 151 | if (is_string($this->value)) { |
| 152 | 152 | return $this->value; |
| 153 | 153 | } |
| 154 | - if (! is_array($this->value)) { |
|
| 154 | + if (!is_array($this->value)) { |
|
| 155 | 155 | return ''; |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | $options = []; |
| 159 | 159 | |
| 160 | 160 | foreach ($this->value as $key => $value) { |
| 161 | - if (is_string($key) && ! is_array($value)) { |
|
| 161 | + if (is_string($key) && !is_array($value)) { |
|
| 162 | 162 | $options[] = $key . '=' . $value; |
| 163 | 163 | } elseif (is_array($value)) { |
| 164 | 164 | $key = key($value); |