-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8391456
commit 98107af
Showing
8 changed files
with
81 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,7 +52,7 @@ | |
'YDbDr', | ||
'YIQ', | ||
'YPbPr', | ||
'YUV' | ||
'YUV', | ||
], | ||
'colors' => [ | ||
'snow', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,15 @@ | |
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the OrbitaleImageMagickPHP package. | ||
* | ||
* (c) Alexandre Rock Ancelet <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Orbitale\Component\ImageMagick\Tests; | ||
|
||
use Orbitale\Component\ImageMagick\Command; | ||
|
@@ -51,15 +60,15 @@ public function testGravity($gravity): void | |
|
||
public function provideValidGravities(): ?\Generator | ||
{ | ||
yield 0 => ["NorthWest"]; | ||
yield 1 => ["North"]; | ||
yield 2 => ["NorthEast"]; | ||
yield 3 => ["West"]; | ||
yield 4 => ["Center"]; | ||
yield 5 => ["East"]; | ||
yield 6 => ["SouthWest"]; | ||
yield 7 => ["South"]; | ||
yield 8 => ["SouthEast"]; | ||
yield 0 => ['NorthWest']; | ||
yield 1 => ['North']; | ||
yield 2 => ['NorthEast']; | ||
yield 3 => ['West']; | ||
yield 4 => ['Center']; | ||
yield 5 => ['East']; | ||
yield 6 => ['SouthWest']; | ||
yield 7 => ['South']; | ||
yield 8 => ['SouthEast']; | ||
} | ||
|
||
/** | ||
|
@@ -70,27 +79,27 @@ public function provideValidGravities(): ?\Generator | |
public function testWrongGravities($gravity): void | ||
{ | ||
$this->expectException(\InvalidArgumentException::class); | ||
$this->expectExceptionMessage("Invalid gravity option, \"" .$gravity. "\" given.\nAvailable: NorthWest, North, NorthEast, West, Center, East, SouthWest, South, SouthEast" ); | ||
$this->expectExceptionMessage('Invalid gravity option, "'.$gravity."\" given.\nAvailable: NorthWest, North, NorthEast, West, Center, East, SouthWest, South, SouthEast"); | ||
|
||
$testGravity = new Gravity($gravity); | ||
$testGravity->validate(); | ||
} | ||
|
||
public function provideWrongGravities(): ?\Generator | ||
{ | ||
yield 0 => ["Northwest"]; | ||
yield 1 => ["northwest"]; | ||
yield 2 => ["north"]; | ||
yield 3 => ["northEast"]; | ||
yield 4 => ["Northeast"]; | ||
yield 5 => ["west"]; | ||
yield 6 => ["center"]; | ||
yield 7 => ["east"]; | ||
yield 8 => ["southwest"]; | ||
yield 9 => ["south"]; | ||
yield 10 => ["southeast"]; | ||
yield 11 => ["Middle"]; | ||
yield 12 => [""]; | ||
yield 13 => [" "]; | ||
yield 0 => ['Northwest']; | ||
yield 1 => ['northwest']; | ||
yield 2 => ['north']; | ||
yield 3 => ['northEast']; | ||
yield 4 => ['Northeast']; | ||
yield 5 => ['west']; | ||
yield 6 => ['center']; | ||
yield 7 => ['east']; | ||
yield 8 => ['southwest']; | ||
yield 9 => ['south']; | ||
yield 10 => ['southeast']; | ||
yield 11 => ['Middle']; | ||
yield 12 => ['']; | ||
yield 13 => [' ']; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,15 @@ | |
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the OrbitaleImageMagickPHP package. | ||
* | ||
* (c) Alexandre Rock Ancelet <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Orbitale\Component\ImageMagick\ReferenceClasses; | ||
|
||
/** | ||
|
@@ -12,15 +21,15 @@ | |
class Gravity | ||
{ | ||
private static $validGravity = [ | ||
"NorthWest", | ||
"North", | ||
"NorthEast", | ||
"West", | ||
"Center", | ||
"East", | ||
"SouthWest", | ||
"South", | ||
"SouthEast" | ||
'NorthWest', | ||
'North', | ||
'NorthEast', | ||
'West', | ||
'Center', | ||
'East', | ||
'SouthWest', | ||
'South', | ||
'SouthEast', | ||
]; | ||
|
||
/** | ||
|
@@ -45,11 +54,8 @@ public function __toString(): string | |
|
||
public function validate(): string | ||
{ | ||
if (!in_array($this->value, self::$validGravity, true)) { | ||
throw new \InvalidArgumentException(\sprintf( | ||
"Invalid gravity option, \"%s\" given.\nAvailable: %s", | ||
$this->value, \implode(', ', self::$validGravity) | ||
)); | ||
if (!\in_array($this->value, self::$validGravity, true)) { | ||
throw new \InvalidArgumentException(\sprintf("Invalid gravity option, \"%s\" given.\nAvailable: %s", $this->value, \implode(', ', self::$validGravity))); | ||
} | ||
|
||
return $this->value; | ||
|
Oops, something went wrong.