Skip to content

Commit 98107af

Browse files
committed
Global CS fix
1 parent 8391456 commit 98107af

File tree

8 files changed

+81
-138
lines changed

8 files changed

+81
-138
lines changed

Resources/references.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
'YDbDr',
5353
'YIQ',
5454
'YPbPr',
55-
'YUV'
55+
'YUV',
5656
],
5757
'colors' => [
5858
'snow',

Tests/AbstractTestCase.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@ public function __construct($name = null, array $data = [], $dataName = '')
2323
{
2424
parent::__construct($name, $data, $dataName);
2525
if (!\defined('IMAGEMAGICK_DIR') || !\defined('TEST_RESOURCES_DIR')) {
26-
throw new \RuntimeException(
27-
"The \"IMAGEMAGICK_DIR\" constant is not defined.\n".
28-
'The bootstrap must be correctly included before executing test suite.'
29-
);
26+
throw new \RuntimeException("The \"IMAGEMAGICK_DIR\" constant is not defined.\n".'The bootstrap must be correctly included before executing test suite.');
3027
}
3128
$this->resourcesDir = TEST_RESOURCES_DIR;
3229
}

Tests/CommandTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ public function provideWrongConvertDirs(): ?\Generator
5151
*/
5252
public function testConvert($fileSources, string $fileOutput): void
5353
{
54-
5554
$command = new Command(IMAGEMAGICK_DIR);
5655

5756
$response = $command
5857
->convert($fileSources)
5958
->output($fileOutput)
60-
->run();
59+
->run()
60+
;
6161

6262
static::assertFileExists($fileOutput);
6363

@@ -212,7 +212,7 @@ public function testColorspaceImage(): void
212212
$this->testConvertIdentifyImage($imageOutput, 'JPEG', '180x170+0+0', '8-bit');
213213
}
214214

215-
public function testMonochrome(): void
215+
public function testMonochrome(): void
216216
{
217217
$command = new Command(IMAGEMAGICK_DIR);
218218

Tests/GravityTest.php

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
declare(strict_types=1);
44

5+
/*
6+
* This file is part of the OrbitaleImageMagickPHP package.
7+
*
8+
* (c) Alexandre Rock Ancelet <alex@orbitale.io>
9+
*
10+
* For the full copyright and license information, please view the LICENSE
11+
* file that was distributed with this source code.
12+
*/
13+
514
namespace Orbitale\Component\ImageMagick\Tests;
615

716
use Orbitale\Component\ImageMagick\Command;
@@ -51,15 +60,15 @@ public function testGravity($gravity): void
5160

5261
public function provideValidGravities(): ?\Generator
5362
{
54-
yield 0 => ["NorthWest"];
55-
yield 1 => ["North"];
56-
yield 2 => ["NorthEast"];
57-
yield 3 => ["West"];
58-
yield 4 => ["Center"];
59-
yield 5 => ["East"];
60-
yield 6 => ["SouthWest"];
61-
yield 7 => ["South"];
62-
yield 8 => ["SouthEast"];
63+
yield 0 => ['NorthWest'];
64+
yield 1 => ['North'];
65+
yield 2 => ['NorthEast'];
66+
yield 3 => ['West'];
67+
yield 4 => ['Center'];
68+
yield 5 => ['East'];
69+
yield 6 => ['SouthWest'];
70+
yield 7 => ['South'];
71+
yield 8 => ['SouthEast'];
6372
}
6473

6574
/**
@@ -70,27 +79,27 @@ public function provideValidGravities(): ?\Generator
7079
public function testWrongGravities($gravity): void
7180
{
7281
$this->expectException(\InvalidArgumentException::class);
73-
$this->expectExceptionMessage("Invalid gravity option, \"" .$gravity. "\" given.\nAvailable: NorthWest, North, NorthEast, West, Center, East, SouthWest, South, SouthEast" );
74-
82+
$this->expectExceptionMessage('Invalid gravity option, "'.$gravity."\" given.\nAvailable: NorthWest, North, NorthEast, West, Center, East, SouthWest, South, SouthEast");
83+
7584
$testGravity = new Gravity($gravity);
7685
$testGravity->validate();
7786
}
7887

7988
public function provideWrongGravities(): ?\Generator
8089
{
81-
yield 0 => ["Northwest"];
82-
yield 1 => ["northwest"];
83-
yield 2 => ["north"];
84-
yield 3 => ["northEast"];
85-
yield 4 => ["Northeast"];
86-
yield 5 => ["west"];
87-
yield 6 => ["center"];
88-
yield 7 => ["east"];
89-
yield 8 => ["southwest"];
90-
yield 9 => ["south"];
91-
yield 10 => ["southeast"];
92-
yield 11 => ["Middle"];
93-
yield 12 => [""];
94-
yield 13 => [" "];
90+
yield 0 => ['Northwest'];
91+
yield 1 => ['northwest'];
92+
yield 2 => ['north'];
93+
yield 3 => ['northEast'];
94+
yield 4 => ['Northeast'];
95+
yield 5 => ['west'];
96+
yield 6 => ['center'];
97+
yield 7 => ['east'];
98+
yield 8 => ['southwest'];
99+
yield 9 => ['south'];
100+
yield 10 => ['southeast'];
101+
yield 11 => ['Middle'];
102+
yield 12 => [''];
103+
yield 13 => [' '];
95104
}
96105
}

src/Command.php

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,7 @@ public function __construct(?string $magickBinaryPath = '')
8989
}
9090

9191
if (0 !== $code || !$process->isSuccessful()) {
92-
throw new \InvalidArgumentException(\sprintf(
93-
"ImageMagick does not seem to work well, the test command resulted in an error.\n".
94-
"Execution returned message: \"{$process->getExitCodeText()}\"\n".
95-
"To solve this issue, please run this command and check your error messages to see if ImageMagick was correctly installed:\n%s",
96-
$magickBinaryPath.' -version'
97-
));
92+
throw new \InvalidArgumentException(\sprintf("ImageMagick does not seem to work well, the test command resulted in an error.\n"."Execution returned message: \"{$process->getExitCodeText()}\"\n"."To solve this issue, please run this command and check your error messages to see if ImageMagick was correctly installed:\n%s", $magickBinaryPath.' -version'));
9893
}
9994

10095
$this->ref = new References();
@@ -123,10 +118,7 @@ public static function findMagickBinaryPath(?string $magickBinaryPath): string
123118
}
124119

125120
if (!\is_executable($magickBinaryPath)) {
126-
throw new \InvalidArgumentException(\sprintf(
127-
'The specified script (%s) is not executable.',
128-
$magickBinaryPath
129-
));
121+
throw new \InvalidArgumentException(\sprintf('The specified script (%s) is not executable.', $magickBinaryPath));
130122
}
131123

132124
return $magickBinaryPath;
@@ -151,12 +143,7 @@ private static function cleanPath(string $path, bool $rtrim = false): string
151143
public function getExecutable(?string $binary = null): array
152144
{
153145
if (!\in_array($binary, static::ALLOWED_EXECUTABLES, true)) {
154-
throw new \InvalidArgumentException(\sprintf(
155-
"The ImageMagick executable \"%s\" is not allowed.\n".
156-
"The only binaries allowed to be executed are the following:\n%s",
157-
$binary,
158-
\implode(', ', static::ALLOWED_EXECUTABLES)
159-
));
146+
throw new \InvalidArgumentException(\sprintf("The ImageMagick executable \"%s\" is not allowed.\n"."The only binaries allowed to be executed are the following:\n%s", $binary, \implode(', ', static::ALLOWED_EXECUTABLES)));
160147
}
161148

162149
return [$this->magickBinaryPath, $binary];
@@ -179,7 +166,7 @@ public function newCommand(?string $binary = null): self
179166
*/
180167
public function convert($sourceFiles, bool $checkIfFileExists = true): self
181168
{
182-
if (!is_array($sourceFiles)) {
169+
if (!\is_array($sourceFiles)) {
183170
$sourceFiles = [$sourceFiles];
184171
}
185172

@@ -497,7 +484,6 @@ public function strip(): self
497484
return $this;
498485
}
499486

500-
501487
/**
502488
* @see http://imagemagick.org/script/command-line-options.php#monochrome
503489
*/
@@ -600,7 +586,7 @@ public function autoOrient(): self
600586
*/
601587
public function depth(int $depth): self
602588
{
603-
$this->command[] = '-depth ' . $depth;
589+
$this->command[] = '-depth '.$depth;
604590

605591
return $this;
606592
}
@@ -665,14 +651,14 @@ public function threshold(string $threshold): self
665651
*/
666652
public function rawCommand(string $command, bool $append = false): self
667653
{
668-
$msg = <<<MSG
654+
$msg = <<<'MSG'
669655
This command is not safe and therefore should not be used, unless you need to use an option that is not supported yet.
670656
Use at your own risk!
671657
If you are certain of what you are doing, you can silence this error using the "@" sign on the instruction that executes this method.
672658
If the option you need is not supported, please open an issue or a pull-request at https://github.com/Orbitale/ImageMagickPHP in order for us to implement the option you need! 😃
673659
MSG
674660
;
675-
@trigger_error($msg, E_STRICT);
661+
@\trigger_error($msg, E_STRICT);
676662

677663
if ($append) {
678664
$this->commandToAppend[] = $command;
@@ -784,11 +770,7 @@ public function polyline(array $coordinates, string $strokeColor = ''): self
784770
protected function checkExistingFile(string $file): string
785771
{
786772
if (!\file_exists($file)) {
787-
throw new \InvalidArgumentException(\sprintf(
788-
'The file "%s" is not found.'."\n".
789-
'If the file really exists in your filesystem, then maybe it is not readable.',
790-
$file
791-
));
773+
throw new \InvalidArgumentException(\sprintf('The file "%s" is not found.'."\n".'If the file really exists in your filesystem, then maybe it is not readable.', $file));
792774
}
793775

794776
return self::cleanPath($file);

src/ReferenceClasses/Geometry.php

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,7 @@ public static function createFromParameters(
6464
}
6565

6666
if ($aspectRatio && !\in_array($aspectRatio, self::$validRatios, true)) {
67-
throw new \InvalidArgumentException(\sprintf(
68-
"Invalid aspect ratio value to generate geometry, \"%s\" given.\nAvailable: %s",
69-
$aspectRatio, \implode(', ', self::$validRatios)
70-
));
67+
throw new \InvalidArgumentException(\sprintf("Invalid aspect ratio value to generate geometry, \"%s\" given.\nAvailable: %s", $aspectRatio, \implode(', ', self::$validRatios)));
7168
}
7269
$geometry .= $aspectRatio;
7370

@@ -139,13 +136,7 @@ public function validate(): string
139136
}
140137

141138
if (\count($errors)) {
142-
throw new \InvalidArgumentException(\sprintf(
143-
"The specified geometry (%s) is invalid.\n%s\n".
144-
"Please refer to ImageMagick command line documentation about geometry:\n%s\n",
145-
$this->value,
146-
\implode("\n", $errors),
147-
'http://www.imagemagick.org/script/command-line-processing.php#geometry'
148-
));
139+
throw new \InvalidArgumentException(\sprintf("The specified geometry (%s) is invalid.\n%s\n"."Please refer to ImageMagick command line documentation about geometry:\n%s\n", $this->value, \implode("\n", $errors), 'http://www.imagemagick.org/script/command-line-processing.php#geometry'));
149140
}
150141

151142
$this->value = \trim($this->value);

src/ReferenceClasses/Gravity.php

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
declare(strict_types=1);
44

5+
/*
6+
* This file is part of the OrbitaleImageMagickPHP package.
7+
*
8+
* (c) Alexandre Rock Ancelet <alex@orbitale.io>
9+
*
10+
* For the full copyright and license information, please view the LICENSE
11+
* file that was distributed with this source code.
12+
*/
13+
514
namespace Orbitale\Component\ImageMagick\ReferenceClasses;
615

716
/**
@@ -12,15 +21,15 @@
1221
class Gravity
1322
{
1423
private static $validGravity = [
15-
"NorthWest",
16-
"North",
17-
"NorthEast",
18-
"West",
19-
"Center",
20-
"East",
21-
"SouthWest",
22-
"South",
23-
"SouthEast"
24+
'NorthWest',
25+
'North',
26+
'NorthEast',
27+
'West',
28+
'Center',
29+
'East',
30+
'SouthWest',
31+
'South',
32+
'SouthEast',
2433
];
2534

2635
/**
@@ -45,11 +54,8 @@ public function __toString(): string
4554

4655
public function validate(): string
4756
{
48-
if (!in_array($this->value, self::$validGravity, true)) {
49-
throw new \InvalidArgumentException(\sprintf(
50-
"Invalid gravity option, \"%s\" given.\nAvailable: %s",
51-
$this->value, \implode(', ', self::$validGravity)
52-
));
57+
if (!\in_array($this->value, self::$validGravity, true)) {
58+
throw new \InvalidArgumentException(\sprintf("Invalid gravity option, \"%s\" given.\nAvailable: %s", $this->value, \implode(', ', self::$validGravity)));
5359
}
5460

5561
return $this->value;

0 commit comments

Comments
 (0)