@@ -60,14 +60,14 @@ discard block |
||
| 60 | 60 | */ |
| 61 | 61 | private function init() : void |
| 62 | 62 | { |
| 63 | - if(self::$initialized === true) |
|
| 63 | + if (self::$initialized === true) |
|
| 64 | 64 | { |
| 65 | 65 | return; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | $this |
| 69 | 69 | ->registerGlobalPreset(self::COLOR_WHITE, 255, 255, 255, 255) |
| 70 | - ->registerGlobalPreset(self::COLOR_BLACK, 0,0,0, 255) |
|
| 70 | + ->registerGlobalPreset(self::COLOR_BLACK, 0, 0, 0, 255) |
|
| 71 | 71 | ->registerGlobalPreset(self::COLOR_TRANSPARENT, 0, 0, 0, 0); |
| 72 | 72 | } |
| 73 | 73 | |
@@ -80,12 +80,12 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | public function getPreset(string $name) : array |
| 82 | 82 | { |
| 83 | - if(isset($this->customPresets[$name])) |
|
| 83 | + if (isset($this->customPresets[$name])) |
|
| 84 | 84 | { |
| 85 | 85 | return $this->customPresets[$name]; |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - if(isset(self::$globalPresets[$name])) |
|
| 88 | + if (isset(self::$globalPresets[$name])) |
|
| 89 | 89 | { |
| 90 | 90 | return self::$globalPresets[$name]; |
| 91 | 91 | } |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | { |
| 114 | 114 | $this->requireNotGlobal($name); |
| 115 | 115 | |
| 116 | - if(!isset(self::$globalPresets[$name])) |
|
| 116 | + if (!isset(self::$globalPresets[$name])) |
|
| 117 | 117 | { |
| 118 | 118 | self::$globalPresets[$name] = array( |
| 119 | 119 | RGBAColor::COMPONENT_RED => $red, |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | ); |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - public function registerPreset(string $name, int $red, int $green, int $blue, int $alpha=255) : RGBAColor_PresetsManager |
|
| 138 | + public function registerPreset(string $name, int $red, int $green, int $blue, int $alpha = 255) : RGBAColor_PresetsManager |
|
| 139 | 139 | { |
| 140 | 140 | $this->requireNotGlobal($name); |
| 141 | 141 | |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | |
| 152 | 152 | private function requireNotGlobal(string $name) : void |
| 153 | 153 | { |
| 154 | - if(!isset(self::$globalPresets[$name])) |
|
| 154 | + if (!isset(self::$globalPresets[$name])) |
|
| 155 | 155 | { |
| 156 | 156 | return; |
| 157 | 157 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | public static function requireValidColorArray(array $color) : void |
| 50 | 50 | { |
| 51 | - if(self::isColorArray($color)) |
|
| 51 | + if (self::isColorArray($color)) |
|
| 52 | 52 | { |
| 53 | 53 | return; |
| 54 | 54 | } |
@@ -80,9 +80,9 @@ discard block |
||
| 80 | 80 | RGBAColor::COMPONENT_BLUE |
| 81 | 81 | ); |
| 82 | 82 | |
| 83 | - foreach($keys as $key) |
|
| 83 | + foreach ($keys as $key) |
|
| 84 | 84 | { |
| 85 | - if(!isset($color[$key])) |
|
| 85 | + if (!isset($color[$key])) |
|
| 86 | 86 | { |
| 87 | 87 | return false; |
| 88 | 88 | } |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | self::int2hex($color[RGBAColor::COMPONENT_GREEN]). |
| 105 | 105 | self::int2hex($color[RGBAColor::COMPONENT_BLUE]); |
| 106 | 106 | |
| 107 | - if(isset($color[RGBAColor::COMPONENT_ALPHA]) && $color[RGBAColor::COMPONENT_ALPHA] < 255) |
|
| 107 | + if (isset($color[RGBAColor::COMPONENT_ALPHA]) && $color[RGBAColor::COMPONENT_ALPHA] < 255) |
|
| 108 | 108 | { |
| 109 | 109 | $hex .= self::int2hex($color[RGBAColor::COMPONENT_ALPHA]); |
| 110 | 110 | } |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | private static function int2hex(int $int) : string |
| 125 | 125 | { |
| 126 | 126 | $str = dechex($int); |
| 127 | - if(strlen($str) === 1) |
|
| 127 | + if (strlen($str) === 1) |
|
| 128 | 128 | { |
| 129 | 129 | $str = $str.$str; |
| 130 | 130 | } |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | public static function color2readable(RGBAColor $color) : string |
| 145 | 145 | { |
| 146 | - if($color->hasTransparency()) |
|
| 146 | + if ($color->hasTransparency()) |
|
| 147 | 147 | { |
| 148 | 148 | return sprintf( |
| 149 | 149 | 'RGBA(%s %s %s %s)', |
@@ -207,11 +207,11 @@ discard block |
||
| 207 | 207 | $hex = strtoupper($hex); |
| 208 | 208 | $length = strlen($hex); |
| 209 | 209 | |
| 210 | - if($length === 3) |
|
| 210 | + if ($length === 3) |
|
| 211 | 211 | { |
| 212 | 212 | return self::parseHEX3($hex); |
| 213 | 213 | } |
| 214 | - else if($length === 6) |
|
| 214 | + else if ($length === 6) |
|
| 215 | 215 | { |
| 216 | 216 | return self::parseHEX6($hex); |
| 217 | 217 | } |