@@ -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 | } |
@@ -41,6 +41,6 @@ |
||
41 | 41 | |
42 | 42 | public function invert() : DecimalChannel |
43 | 43 | { |
44 | - return ColorChannel::decimal(1-$this->value); |
|
44 | + return ColorChannel::decimal(1 - $this->value); |
|
45 | 45 | } |
46 | 46 | } |
@@ -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 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @param bool $selfClosing |
55 | 55 | * @return $this |
56 | 56 | */ |
57 | - public function setSelfClosing(bool $selfClosing=true) : self |
|
57 | + public function setSelfClosing(bool $selfClosing = true) : self |
|
58 | 58 | { |
59 | 59 | $this->selfClosing = $selfClosing; |
60 | 60 | return $this; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | * @param bool $allowed |
70 | 70 | * @return $this |
71 | 71 | */ |
72 | - public function setEmptyAllowed(bool $allowed=true) : self |
|
72 | + public function setEmptyAllowed(bool $allowed = true) : self |
|
73 | 73 | { |
74 | 74 | $this->allowEmpty = $allowed; |
75 | 75 | return $this; |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | public function isEmptyAllowed() : bool |
79 | 79 | { |
80 | - if($this->isSelfClosing()) |
|
80 | + if ($this->isSelfClosing()) |
|
81 | 81 | { |
82 | 82 | return true; |
83 | 83 | } |
@@ -85,9 +85,9 @@ discard block |
||
85 | 85 | return $this->allowEmpty; |
86 | 86 | } |
87 | 87 | |
88 | - public static function create(string $name, ?AttributeCollection $attributes=null) : HTMLTag |
|
88 | + public static function create(string $name, ?AttributeCollection $attributes = null) : HTMLTag |
|
89 | 89 | { |
90 | - if($attributes === null) |
|
90 | + if ($attributes === null) |
|
91 | 91 | { |
92 | 92 | $attributes = AttributeCollection::create(); |
93 | 93 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | |
114 | 114 | public function render() : string |
115 | 115 | { |
116 | - if(!$this->isEmptyAllowed() && $this->isEmpty()) |
|
116 | + if (!$this->isEmptyAllowed() && $this->isEmpty()) |
|
117 | 117 | { |
118 | 118 | return ''; |
119 | 119 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | public static function getGlobalOptions() : GlobalOptions |
128 | 128 | { |
129 | - if(!isset(self::$globalOptions)) |
|
129 | + if (!isset(self::$globalOptions)) |
|
130 | 130 | { |
131 | 131 | self::$globalOptions = new GlobalOptions(); |
132 | 132 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | |
137 | 137 | public function getSelfClosingChar() : string |
138 | 138 | { |
139 | - if($this->selfClosing && self::getGlobalOptions()->getSelfCloseStyle() === self::SELF_CLOSE_STYLE_SLASH) |
|
139 | + if ($this->selfClosing && self::getGlobalOptions()->getSelfCloseStyle() === self::SELF_CLOSE_STYLE_SLASH) |
|
140 | 140 | { |
141 | 141 | return '/'; |
142 | 142 | } |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | |
157 | 157 | public function renderClose() : string |
158 | 158 | { |
159 | - if($this->selfClosing) |
|
159 | + if ($this->selfClosing) |
|
160 | 160 | { |
161 | 161 | return ''; |
162 | 162 | } |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | |
201 | 201 | public function renderContent() : string |
202 | 202 | { |
203 | - if($this->selfClosing) |
|
203 | + if ($this->selfClosing) |
|
204 | 204 | { |
205 | 205 | return ''; |
206 | 206 | } |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | * @param bool $enabled |
230 | 230 | * @return $this |
231 | 231 | */ |
232 | - public function prop(string $name, bool $enabled=true) : self |
|
232 | + public function prop(string $name, bool $enabled = true) : self |
|
233 | 233 | { |
234 | 234 | $this->attributes->prop($name, $enabled); |
235 | 235 | return $this; |
@@ -29,17 +29,17 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public static function fromString($string) : bool |
31 | 31 | { |
32 | - if($string === '' || !is_scalar($string)) |
|
32 | + if ($string === '' || !is_scalar($string)) |
|
33 | 33 | { |
34 | 34 | return false; |
35 | 35 | } |
36 | 36 | |
37 | - if(is_bool($string)) |
|
37 | + if (is_bool($string)) |
|
38 | 38 | { |
39 | 39 | return $string; |
40 | 40 | } |
41 | 41 | |
42 | - if(array_key_exists($string, self::$booleanStrings)) |
|
42 | + if (array_key_exists($string, self::$booleanStrings)) |
|
43 | 43 | { |
44 | 44 | return self::$booleanStrings[$string]; |
45 | 45 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | public static function toString($boolean, bool $yesno = false) : string |
70 | 70 | { |
71 | 71 | // allow 'yes', 'true', 'no', 'false' string notations as well |
72 | - if(!is_bool($boolean)) { |
|
72 | + if (!is_bool($boolean)) { |
|
73 | 73 | $boolean = self::fromString($boolean); |
74 | 74 | } |
75 | 75 | |
@@ -125,11 +125,11 @@ discard block |
||
125 | 125 | */ |
126 | 126 | public static function isBoolean($value) : bool |
127 | 127 | { |
128 | - if(is_bool($value)) { |
|
128 | + if (is_bool($value)) { |
|
129 | 129 | return true; |
130 | 130 | } |
131 | 131 | |
132 | - if(!is_scalar($value)) { |
|
132 | + if (!is_scalar($value)) { |
|
133 | 133 | return false; |
134 | 134 | } |
135 | 135 |
@@ -39,13 +39,13 @@ discard block |
||
39 | 39 | self::SERIALIZED_PREVIOUS => null, |
40 | 40 | ); |
41 | 41 | |
42 | - if($info->hasPrevious()) |
|
42 | + if ($info->hasPrevious()) |
|
43 | 43 | { |
44 | 44 | $result[self::SERIALIZED_PREVIOUS] = $info->getPrevious()->serialize(); |
45 | 45 | } |
46 | 46 | |
47 | 47 | $calls = $info->getCalls(); |
48 | - foreach($calls as $call) |
|
48 | + foreach ($calls as $call) |
|
49 | 49 | { |
50 | 50 | $result[self::SERIALIZED_CALLS][] = $call->serialize(); |
51 | 51 | } |
@@ -63,12 +63,12 @@ discard block |
||
63 | 63 | $data = self::validateSerializedData($serialized); |
64 | 64 | $data[self::SERIALIZED_PREVIOUS] = self::unserializePrevious($data[self::SERIALIZED_PREVIOUS]); |
65 | 65 | |
66 | - if(!isset($data[self::SERIALIZED_CLASS])) |
|
66 | + if (!isset($data[self::SERIALIZED_CLASS])) |
|
67 | 67 | { |
68 | 68 | $data[self::SERIALIZED_CLASS] = ''; |
69 | 69 | } |
70 | 70 | |
71 | - if(!isset($data[self::SERIALIZED_DETAILS])) |
|
71 | + if (!isset($data[self::SERIALIZED_DETAILS])) |
|
72 | 72 | { |
73 | 73 | $data[self::SERIALIZED_DETAILS] = ''; |
74 | 74 | } |
@@ -94,9 +94,9 @@ discard block |
||
94 | 94 | self::SERIALIZED_CALLS => 'array' |
95 | 95 | ); |
96 | 96 | |
97 | - foreach($keys as $key => $type) |
|
97 | + foreach ($keys as $key => $type) |
|
98 | 98 | { |
99 | - if(!isset($serialized[$key]) || gettype($serialized[$key]) !== $type) |
|
99 | + if (!isset($serialized[$key]) || gettype($serialized[$key]) !== $type) |
|
100 | 100 | { |
101 | 101 | throw self::createTypeException($key, $type); |
102 | 102 | } |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | */ |
126 | 126 | private static function unserializePrevious(?array $previous) : ?ConvertHelper_ThrowableInfo |
127 | 127 | { |
128 | - if(!empty($previous)) |
|
128 | + if (!empty($previous)) |
|
129 | 129 | { |
130 | 130 | return ConvertHelper_ThrowableInfo::fromSerialized($previous); |
131 | 131 | } |