@@ -14,37 +14,37 @@ |
||
14 | 14 | return 'font-size'; |
15 | 15 | } |
16 | 16 | |
17 | - public function relativeLarger(bool $important=false) : StyleBuilder |
|
17 | + public function relativeLarger(bool $important = false) : StyleBuilder |
|
18 | 18 | { |
19 | 19 | return $this->setStyle('larger', $important); |
20 | 20 | } |
21 | 21 | |
22 | - public function relativeSmaller(bool $important=false) : StyleBuilder |
|
22 | + public function relativeSmaller(bool $important = false) : StyleBuilder |
|
23 | 23 | { |
24 | 24 | return $this->setStyle('smaller', $important); |
25 | 25 | } |
26 | 26 | |
27 | - public function custom(string $value, bool $important=false) : StyleBuilder |
|
27 | + public function custom(string $value, bool $important = false) : StyleBuilder |
|
28 | 28 | { |
29 | 29 | return $this->setStyle($value, $important); |
30 | 30 | } |
31 | 31 | |
32 | - public function percent(float $percent, bool $important=false) : StyleBuilder |
|
32 | + public function percent(float $percent, bool $important = false) : StyleBuilder |
|
33 | 33 | { |
34 | 34 | return $this->setStylePercent($percent, $important); |
35 | 35 | } |
36 | 36 | |
37 | - public function px(int $pixels, bool $important=false) : StyleBuilder |
|
37 | + public function px(int $pixels, bool $important = false) : StyleBuilder |
|
38 | 38 | { |
39 | 39 | return $this->setStylePX($pixels, $important); |
40 | 40 | } |
41 | 41 | |
42 | - public function em(float $em, bool $important=false) : StyleBuilder |
|
42 | + public function em(float $em, bool $important = false) : StyleBuilder |
|
43 | 43 | { |
44 | 44 | return $this->setStyleEM($em, $important); |
45 | 45 | } |
46 | 46 | |
47 | - public function rem(float $rem, bool $important=false) : StyleBuilder |
|
47 | + public function rem(float $rem, bool $important = false) : StyleBuilder |
|
48 | 48 | { |
49 | 49 | return $this->setStyleREM($rem, $important); |
50 | 50 | } |
@@ -33,11 +33,11 @@ |
||
33 | 33 | |
34 | 34 | public function weight() : FontWeight |
35 | 35 | { |
36 | - return new FontWeight($this->styles,$this->collection); |
|
36 | + return new FontWeight($this->styles, $this->collection); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | public function size() : FontSize |
40 | 40 | { |
41 | - return new FontSize($this->styles,$this->collection); |
|
41 | + return new FontSize($this->styles, $this->collection); |
|
42 | 42 | } |
43 | 43 | } |
@@ -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 | } |
@@ -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,14 +62,14 @@ 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 | } |
69 | 69 | |
70 | 70 | $this |
71 | 71 | ->registerGlobalPreset(self::COLOR_WHITE, 255, 255, 255, 255) |
72 | - ->registerGlobalPreset(self::COLOR_BLACK, 0,0,0, 255) |
|
72 | + ->registerGlobalPreset(self::COLOR_BLACK, 0, 0, 0, 255) |
|
73 | 73 | ->registerGlobalPreset(self::COLOR_TRANSPARENT, 0, 0, 0, 0); |
74 | 74 | } |
75 | 75 | |
@@ -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 | } |