Passed
Push — master ( 9d70d1...e76473 )
by Sebastian
03:43
created
src/RGBAColor/ColorFactory.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      */
39 39
     public static function getPresetsManager() : PresetsManager
40 40
     {
41
-        if(!isset(self::$presets))
41
+        if (!isset(self::$presets))
42 42
         {
43 43
             self::$presets = new PresetsManager();
44 44
         }
@@ -54,9 +54,9 @@  discard block
 block discarded – undo
54 54
      * @param string $name
55 55
      * @return RGBAColor
56 56
      */
57
-    public static function create(ColorChannel $red, ColorChannel $green, ColorChannel $blue, ?ColorChannel $opacity=null, string $name='') : RGBAColor
57
+    public static function create(ColorChannel $red, ColorChannel $green, ColorChannel $blue, ?ColorChannel $opacity = null, string $name = '') : RGBAColor
58 58
     {
59
-        if($opacity === null)
59
+        if ($opacity === null)
60 60
         {
61 61
             $opacity = ColorChannel::eightBit(255);
62 62
         }
@@ -83,31 +83,31 @@  discard block
 block discarded – undo
83 83
      */
84 84
     public static function createAuto($subject) : ?RGBAColor
85 85
     {
86
-        if($subject instanceof RGBAColor)
86
+        if ($subject instanceof RGBAColor)
87 87
         {
88 88
             return $subject;
89 89
         }
90 90
 
91
-        if(is_array($subject))
91
+        if (is_array($subject))
92 92
         {
93 93
             return self::createFrom8BitArray($subject);
94 94
         }
95 95
 
96 96
         $hexOrPreset = (string)$subject;
97 97
 
98
-        if($hexOrPreset === '')
98
+        if ($hexOrPreset === '')
99 99
         {
100 100
             return null;
101 101
         }
102 102
 
103 103
         $manager = self::getPresetsManager();
104 104
 
105
-        if($manager->hasPreset($hexOrPreset))
105
+        if ($manager->hasPreset($hexOrPreset))
106 106
         {
107 107
             return $manager->getPreset($hexOrPreset);
108 108
         }
109 109
 
110
-        if(preg_match('/[a-f0-9]{3,8}/i', $hexOrPreset))
110
+        if (preg_match('/[a-f0-9]{3,8}/i', $hexOrPreset))
111 111
         {
112 112
             return self::createFromHEX($hexOrPreset);
113 113
         }
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
     {
156 156
         $color = FormatsConverter::array2associative($color);
157 157
 
158
-        if(!isset($color[RGBAColor::CHANNEL_ALPHA]))
158
+        if (!isset($color[RGBAColor::CHANNEL_ALPHA]))
159 159
         {
160 160
             $color[RGBAColor::CHANNEL_ALPHA] = 255;
161 161
         }
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
      * @see RGBAColor::ERROR_INVALID_COLOR_COMPONENT
181 181
      * @see RGBAColor::ERROR_INVALID_PERCENTAGE_VALUE
182 182
      */
183
-    public static function createFromHEX(string $hex, string $name='') : RGBAColor
183
+    public static function createFromHEX(string $hex, string $name = '') : RGBAColor
184 184
     {
185 185
         return FormatsConverter::hex2color($hex, $name);
186 186
     }
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
      * @param string $name
206 206
      * @return RGBAColor
207 207
      */
208
-    public static function createPercent(float $red, float $green, float $blue, float $opacity=100, string $name='') : RGBAColor
208
+    public static function createPercent(float $red, float $green, float $blue, float $opacity = 100, string $name = '') : RGBAColor
209 209
     {
210 210
         return new RGBAColor(
211 211
             ColorChannel::percent($red),
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
      * @param string $name
228 228
      * @return RGBAColor
229 229
      */
230
-    public static function createCSS(int $red, int $green, int $blue, float $opacity=1, string $name='') : RGBAColor
230
+    public static function createCSS(int $red, int $green, int $blue, float $opacity = 1, string $name = '') : RGBAColor
231 231
     {
232 232
         return self::create(
233 233
             ColorChannel::eightBit($red),
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
      * @param string $name
249 249
      * @return RGBAColor
250 250
      */
251
-    public static function create8Bit(int $red, int $green, int $blue, int $opacity=255, string $name='') : RGBAColor
251
+    public static function create8Bit(int $red, int $green, int $blue, int $opacity = 255, string $name = '') : RGBAColor
252 252
     {
253 253
         return self::create(
254 254
             ColorChannel::eightBit($red),
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
      * @param string $name
272 272
      * @return RGBAColor
273 273
      */
274
-    public static function createGD(int $red, int $green, int $blue, int $opacity=127, string $name='') : RGBAColor
274
+    public static function createGD(int $red, int $green, int $blue, int $opacity = 127, string $name = '') : RGBAColor
275 275
     {
276 276
         return self::create(
277 277
             ColorChannel::eightBit($red),
Please login to merge, or discard this patch.
src/RGBAColor/ColorChannel/EightBitChannel.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,6 +41,6 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/RGBAColor/ColorChannel/HexadecimalChannel.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
src/RGBAColor/ColorChannel/SevenBitChannel.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,6 +56,6 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/RGBAColor/ColorChannel/PercentChannel.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,6 +41,6 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/RGBAColor/ColorChannel/DecimalChannel.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,6 +41,6 @@
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/AttributeCollection.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      */
66 66
     public function setAttributes(array $attributes) : AttributeCollection
67 67
     {
68
-        foreach($attributes as $name => $value)
68
+        foreach ($attributes as $name => $value)
69 69
         {
70 70
             $this->attr($name, $value);
71 71
         }
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
         return $this;
74 74
     }
75 75
 
76
-    public function getAttribute(string $name, string $default='') : string
76
+    public function getAttribute(string $name, string $default = '') : string
77 77
     {
78 78
         return $this->attributes[$name] ?? $default;
79 79
     }
@@ -82,14 +82,14 @@  discard block
 block discarded – undo
82 82
      * @param array<string,string|number|bool|NULL|Interface_Stringable|StringBuilder_Interface> $attributes
83 83
      * @return AttributeCollection
84 84
      */
85
-    public static function create(array $attributes=array()) : AttributeCollection
85
+    public static function create(array $attributes = array()) : AttributeCollection
86 86
     {
87 87
         return new AttributeCollection($attributes);
88 88
     }
89 89
 
90
-    public function prop(string $name, bool $enabled=true) : AttributeCollection
90
+    public function prop(string $name, bool $enabled = true) : AttributeCollection
91 91
     {
92
-        if($enabled)
92
+        if ($enabled)
93 93
         {
94 94
             return $this->attr($name, $name);
95 95
         }
@@ -106,18 +106,18 @@  discard block
 block discarded – undo
106 106
     {
107 107
         $string = Filtering::value2string($value);
108 108
 
109
-        if($name === 'class')
109
+        if ($name === 'class')
110 110
         {
111 111
             return $this->addClasses(ConvertHelper::explodeTrim(' ', $string));
112 112
         }
113 113
 
114
-        if($name === 'style')
114
+        if ($name === 'style')
115 115
         {
116 116
             $this->styles->parseStylesString($string);
117 117
             return $this;
118 118
         }
119 119
 
120
-        if($string !== '')
120
+        if ($string !== '')
121 121
         {
122 122
             $this->attributes[$name] = $string;
123 123
         }
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
     {
137 137
         $this->attr($name, $value);
138 138
 
139
-        if(isset($this->attributes[$name]))
139
+        if (isset($this->attributes[$name]))
140 140
         {
141 141
             $this->attributes[$name] = Filtering::quotes($this->attributes[$name]);
142 142
         }
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 
152 152
     public function remove(string $name) : AttributeCollection
153 153
     {
154
-        if(isset($this->attributes[$name]))
154
+        if (isset($this->attributes[$name]))
155 155
         {
156 156
             unset($this->attributes[$name]);
157 157
         }
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 
179 179
     private function getRenderer() : AttributesRenderer
180 180
     {
181
-        if(!isset($this->renderer))
181
+        if (!isset($this->renderer))
182 182
         {
183 183
             $this->renderer = new AttributesRenderer($this);
184 184
         }
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 
240 240
     public const TARGET_BLANK = '_blank';
241 241
 
242
-    public function target(string $value=self::TARGET_BLANK) : AttributeCollection
242
+    public function target(string $value = self::TARGET_BLANK) : AttributeCollection
243 243
     {
244 244
         return $this->attr('target', $value);
245 245
     }
Please login to merge, or discard this patch.
src/HTMLTag.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/ConvertHelper/Bool.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,17 +29,17 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.