@@ -11,17 +11,17 @@ discard block |
||
11 | 11 | |
12 | 12 | abstract class ColorContainer extends StyleContainer |
13 | 13 | { |
14 | - public function rgbaValues(int $red, int $green, int $blue, float $opacity=1) : StyleBuilder |
|
14 | + public function rgbaValues(int $red, int $green, int $blue, float $opacity = 1) : StyleBuilder |
|
15 | 15 | { |
16 | 16 | return $this->rgba(ColorFactory::createCSS($red, $green, $blue, $opacity)); |
17 | 17 | } |
18 | 18 | |
19 | - public function rgba(RGBAColor $color, bool $important=false) : StyleBuilder |
|
19 | + public function rgba(RGBAColor $color, bool $important = false) : StyleBuilder |
|
20 | 20 | { |
21 | 21 | return $this->setStyle($color->toCSS(), $important); |
22 | 22 | } |
23 | 23 | |
24 | - public function hex(RGBAColor $color, bool $important=false) : StyleBuilder |
|
24 | + public function hex(RGBAColor $color, bool $important = false) : StyleBuilder |
|
25 | 25 | { |
26 | 26 | return $this->setStyle('#'.$color->toHEX(), $important); |
27 | 27 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @return StyleBuilder |
35 | 35 | * @throws ColorException |
36 | 36 | */ |
37 | - public function hexString(string $hex, bool $important=false) : StyleBuilder |
|
37 | + public function hexString(string $hex, bool $important = false) : StyleBuilder |
|
38 | 38 | { |
39 | 39 | return $this->hex(ColorFactory::createFromHEX($hex), $important); |
40 | 40 | } |
@@ -8,17 +8,17 @@ |
||
8 | 8 | |
9 | 9 | abstract class NumericContainer extends StyleContainer |
10 | 10 | { |
11 | - public function px(int $px, bool $important=false) : StyleBuilder |
|
11 | + public function px(int $px, bool $important = false) : StyleBuilder |
|
12 | 12 | { |
13 | 13 | return $this->setStylePX($px, $important); |
14 | 14 | } |
15 | 15 | |
16 | - public function percent(float $percent, bool $important=false) : StyleBuilder |
|
16 | + public function percent(float $percent, bool $important = false) : StyleBuilder |
|
17 | 17 | { |
18 | 18 | return $this->setStylePercent($percent, $important); |
19 | 19 | } |
20 | 20 | |
21 | - public function em(float $percent, bool $important=false) : StyleBuilder |
|
21 | + public function em(float $percent, bool $important = false) : StyleBuilder |
|
22 | 22 | { |
23 | 23 | return $this->setStyleEM($percent, $important); |
24 | 24 | } |
@@ -21,9 +21,9 @@ discard block |
||
21 | 21 | */ |
22 | 22 | private $collection; |
23 | 23 | |
24 | - private function __construct(?StyleCollection $collection=null) |
|
24 | + private function __construct(?StyleCollection $collection = null) |
|
25 | 25 | { |
26 | - if($collection === null) |
|
26 | + if ($collection === null) |
|
27 | 27 | { |
28 | 28 | $collection = StyleCollection::create(); |
29 | 29 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | $this->collection = $collection; |
32 | 32 | } |
33 | 33 | |
34 | - public static function create(?StyleCollection $collection=null) : StyleBuilder |
|
34 | + public static function create(?StyleCollection $collection = null) : StyleBuilder |
|
35 | 35 | { |
36 | 36 | return new StyleBuilder($collection); |
37 | 37 | } |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | public static function color2HEX(RGBAColor $color) : string |
41 | 41 | { |
42 | 42 | $hex = |
43 | - UnitsConverter::int2hex($color->getRed()->get8Bit()) . |
|
44 | - UnitsConverter::int2hex($color->getGreen()->get8Bit()) . |
|
43 | + UnitsConverter::int2hex($color->getRed()->get8Bit()). |
|
44 | + UnitsConverter::int2hex($color->getGreen()->get8Bit()). |
|
45 | 45 | UnitsConverter::int2hex($color->getBlue()->get8Bit()); |
46 | 46 | |
47 | - if($color->hasTransparency()) |
|
47 | + if ($color->hasTransparency()) |
|
48 | 48 | { |
49 | 49 | $hex .= UnitsConverter::int2hex($color->getOpacity()->get8Bit()); |
50 | 50 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public static function color2CSS(RGBAColor $color) : string |
62 | 62 | { |
63 | - if($color->hasTransparency()) |
|
63 | + if ($color->hasTransparency()) |
|
64 | 64 | { |
65 | 65 | return sprintf( |
66 | 66 | 'rgba(%s, %s, %s, %s)', |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public static function requireValidColorArray(array $color) : void |
97 | 97 | { |
98 | - if(self::isColorArray($color)) |
|
98 | + if (self::isColorArray($color)) |
|
99 | 99 | { |
100 | 100 | return; |
101 | 101 | } |
@@ -127,9 +127,9 @@ discard block |
||
127 | 127 | RGBAColor::CHANNEL_BLUE |
128 | 128 | ); |
129 | 129 | |
130 | - foreach($keys as $key) |
|
130 | + foreach ($keys as $key) |
|
131 | 131 | { |
132 | - if(!isset($color[$key])) |
|
132 | + if (!isset($color[$key])) |
|
133 | 133 | { |
134 | 134 | return false; |
135 | 135 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | */ |
149 | 149 | public static function color2readable(RGBAColor $color) : string |
150 | 150 | { |
151 | - if($color->hasTransparency()) |
|
151 | + if ($color->hasTransparency()) |
|
152 | 152 | { |
153 | 153 | return sprintf( |
154 | 154 | 'RGBA(%s %s %s %s)', |
@@ -191,9 +191,9 @@ discard block |
||
191 | 191 | * @throws ColorException |
192 | 192 | * @see RGBAColor::ERROR_INVALID_HEX_LENGTH |
193 | 193 | */ |
194 | - public static function hex2color(string $hex, string $name='') : RGBAColor |
|
194 | + public static function hex2color(string $hex, string $name = '') : RGBAColor |
|
195 | 195 | { |
196 | - if(!isset(self::$hexParser)) |
|
196 | + if (!isset(self::$hexParser)) |
|
197 | 197 | { |
198 | 198 | self::$hexParser = new HEXParser(); |
199 | 199 | } |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | { |
246 | 246 | // If one associative key is present, we assume |
247 | 247 | // that the color array is already correct. |
248 | - if(isset($color[RGBAColor::CHANNEL_RED])) |
|
248 | + if (isset($color[RGBAColor::CHANNEL_RED])) |
|
249 | 249 | { |
250 | 250 | return $color; |
251 | 251 | } |
@@ -253,15 +253,15 @@ discard block |
||
253 | 253 | $values = array_values($color); |
254 | 254 | $result = array(); |
255 | 255 | |
256 | - foreach(self::$keys as $idx => $def) |
|
256 | + foreach (self::$keys as $idx => $def) |
|
257 | 257 | { |
258 | - if(isset($values[$idx])) |
|
258 | + if (isset($values[$idx])) |
|
259 | 259 | { |
260 | 260 | $result[$def['key']] = $values[$idx]; |
261 | 261 | continue; |
262 | 262 | } |
263 | 263 | |
264 | - if(!$def['mandatory']) |
|
264 | + if (!$def['mandatory']) |
|
265 | 265 | { |
266 | 266 | continue; |
267 | 267 | } |
@@ -98,7 +98,7 @@ |
||
98 | 98 | |
99 | 99 | public static function percent2Float(float $percent) : float |
100 | 100 | { |
101 | - return round($percent/100, self::$floatPrecision); |
|
101 | + return round($percent / 100, self::$floatPrecision); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | public static function float2percent(float $value) : float |
@@ -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 | } |
@@ -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 |