@@ -41,9 +41,9 @@ |
||
41 | 41 | { |
42 | 42 | $parts = array(RGBAColor::CHANNEL_RED, RGBAColor::CHANNEL_GREEN, RGBAColor::CHANNEL_BLUE); |
43 | 43 | |
44 | - foreach($parts as $part) |
|
44 | + foreach ($parts as $part) |
|
45 | 45 | { |
46 | - if($sourceColor->getColor($part)->get8Bit() !== $targetColor->getColor($part)->get8Bit()) |
|
46 | + if ($sourceColor->getColor($part)->get8Bit() !== $targetColor->getColor($part)->get8Bit()) |
|
47 | 47 | { |
48 | 48 | return false; |
49 | 49 | } |
@@ -92,8 +92,7 @@ |
||
92 | 92 | if(isset($this->customPresets[$name])) |
93 | 93 | { |
94 | 94 | $preset = $this->customPresets[$name]; |
95 | - } |
|
96 | - else if(isset(self::$globalPresets[$name])) |
|
95 | + } else if(isset(self::$globalPresets[$name])) |
|
97 | 96 | { |
98 | 97 | $preset = self::$globalPresets[$name]; |
99 | 98 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | */ |
63 | 63 | private function init() : void |
64 | 64 | { |
65 | - if(self::$initialized === true) |
|
65 | + if (self::$initialized === true) |
|
66 | 66 | { |
67 | 67 | return; |
68 | 68 | } |
@@ -89,16 +89,16 @@ discard block |
||
89 | 89 | { |
90 | 90 | $preset = null; |
91 | 91 | |
92 | - if(isset($this->customPresets[$name])) |
|
92 | + if (isset($this->customPresets[$name])) |
|
93 | 93 | { |
94 | 94 | $preset = $this->customPresets[$name]; |
95 | 95 | } |
96 | - else if(isset(self::$globalPresets[$name])) |
|
96 | + else if (isset(self::$globalPresets[$name])) |
|
97 | 97 | { |
98 | 98 | $preset = self::$globalPresets[$name]; |
99 | 99 | } |
100 | 100 | |
101 | - if($preset !== null) |
|
101 | + if ($preset !== null) |
|
102 | 102 | { |
103 | 103 | return ColorFactory::create( |
104 | 104 | ColorChannel::eightBit($preset[RGBAColor::CHANNEL_RED]), |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | { |
133 | 133 | $this->requireNotGlobal($name); |
134 | 134 | |
135 | - if(!isset(self::$globalPresets[$name])) |
|
135 | + if (!isset(self::$globalPresets[$name])) |
|
136 | 136 | { |
137 | 137 | self::$globalPresets[$name] = array( |
138 | 138 | RGBAColor::CHANNEL_RED => $red, |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | ); |
155 | 155 | } |
156 | 156 | |
157 | - public function registerPreset(string $name, int $red, int $green, int $blue, int $alpha=255) : PresetsManager |
|
157 | + public function registerPreset(string $name, int $red, int $green, int $blue, int $alpha = 255) : PresetsManager |
|
158 | 158 | { |
159 | 159 | $this->requireNotGlobal($name); |
160 | 160 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | |
171 | 171 | private function requireNotGlobal(string $name) : void |
172 | 172 | { |
173 | - if(!isset(self::$globalPresets[$name])) |
|
173 | + if (!isset(self::$globalPresets[$name])) |
|
174 | 174 | { |
175 | 175 | return; |
176 | 176 | } |
@@ -21,18 +21,18 @@ |
||
21 | 21 | * @throws ColorException |
22 | 22 | * @see RGBAColor::ERROR_INVALID_HEX_LENGTH |
23 | 23 | */ |
24 | - public function parse(string $hex, string $name='') : RGBAColor |
|
24 | + public function parse(string $hex, string $name = '') : RGBAColor |
|
25 | 25 | { |
26 | 26 | $hex = ltrim($hex, '#'); // Remove the hash if present |
27 | 27 | $hex = strtoupper($hex); |
28 | 28 | $length = strlen($hex); |
29 | 29 | |
30 | - if($length === 3) |
|
30 | + if ($length === 3) |
|
31 | 31 | { |
32 | 32 | return $this->parseHEX3($hex, $name); |
33 | 33 | } |
34 | 34 | |
35 | - if($length === 6) |
|
35 | + if ($length === 6) |
|
36 | 36 | { |
37 | 37 | return $this->parseHEX6($hex, $name); |
38 | 38 | } |
@@ -9,9 +9,9 @@ |
||
9 | 9 | |
10 | 10 | declare(strict_types=1); |
11 | 11 | |
12 | -$autoload = __DIR__ . '/../vendor/autoload.php'; |
|
12 | +$autoload = __DIR__.'/../vendor/autoload.php'; |
|
13 | 13 | |
14 | -if(!file_exists($autoload)) |
|
14 | +if (!file_exists($autoload)) |
|
15 | 15 | { |
16 | 16 | die('<b>ERROR:</b> Autoloader not present. Please run composer install first.'); |
17 | 17 | } |
@@ -42,7 +42,7 @@ |
||
42 | 42 | <br> |
43 | 43 | <?php |
44 | 44 | |
45 | - foreach($urls as $url) |
|
45 | + foreach ($urls as $url) |
|
46 | 46 | { |
47 | 47 | $info = parseURL($url); |
48 | 48 |
@@ -41,6 +41,6 @@ |
||
41 | 41 | |
42 | 42 | public function invert() : EightBitChannel |
43 | 43 | { |
44 | - return ColorChannel::eightBit(255-$this->value); |
|
44 | + return ColorChannel::eightBit(255 - $this->value); |
|
45 | 45 | } |
46 | 46 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | { |
37 | 37 | $this->validateValue($value); |
38 | 38 | |
39 | - if(strlen($value) === 1) |
|
39 | + if (strlen($value) === 1) |
|
40 | 40 | { |
41 | 41 | $value = str_repeat($value, 2); |
42 | 42 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | { |
54 | 54 | $match = preg_match('/\A[0-9A-F]{1,2}\z/iU', $hex); |
55 | 55 | |
56 | - if($match !== false && $match > 0) |
|
56 | + if ($match !== false && $match > 0) |
|
57 | 57 | { |
58 | 58 | return; |
59 | 59 | } |
@@ -56,6 +56,6 @@ |
||
56 | 56 | |
57 | 57 | public function invert() : SevenBitChannel |
58 | 58 | { |
59 | - return ColorChannel::sevenBit(127-$this->value); |
|
59 | + return ColorChannel::sevenBit(127 - $this->value); |
|
60 | 60 | } |
61 | 61 | } |
@@ -41,6 +41,6 @@ |
||
41 | 41 | |
42 | 42 | public function invert() : PercentChannel |
43 | 43 | { |
44 | - return ColorChannel::percent(100-$this->value); |
|
44 | + return ColorChannel::percent(100 - $this->value); |
|
45 | 45 | } |
46 | 46 | } |