Passed
Push — master ( 689ec5...45f08c )
by Sebastian
05:26
created
src/AttributeCollection.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
      */
64 64
     public function setAttributes(array $attributes) : AttributeCollection
65 65
     {
66
-        foreach($attributes as $name => $value)
66
+        foreach ($attributes as $name => $value)
67 67
         {
68 68
             $this->attr($name, $value);
69 69
         }
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
         return $this;
72 72
     }
73 73
 
74
-    public function getAttribute(string $name, string $default='') : string
74
+    public function getAttribute(string $name, string $default = '') : string
75 75
     {
76 76
         return $this->attributes[$name] ?? $default;
77 77
     }
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
      * @param array<string,string|number> $attributes
81 81
      * @return AttributeCollection
82 82
      */
83
-    public static function create(array $attributes=array()) : AttributeCollection
83
+    public static function create(array $attributes = array()) : AttributeCollection
84 84
     {
85 85
         return new AttributeCollection($attributes);
86 86
     }
87 87
 
88
-    public function prop(string $name, bool $enabled=true) : AttributeCollection
88
+    public function prop(string $name, bool $enabled = true) : AttributeCollection
89 89
     {
90
-        if($enabled)
90
+        if ($enabled)
91 91
         {
92 92
             return $this->attr($name, $name);
93 93
         }
@@ -104,18 +104,18 @@  discard block
 block discarded – undo
104 104
     {
105 105
         $string = Filtering::value2string($value);
106 106
 
107
-        if($name === 'class')
107
+        if ($name === 'class')
108 108
         {
109 109
             return $this->addClasses(ConvertHelper::explodeTrim(' ', $string));
110 110
         }
111 111
 
112
-        if($name === 'style')
112
+        if ($name === 'style')
113 113
         {
114 114
             $this->styles->parseStylesString($string);
115 115
             return $this;
116 116
         }
117 117
 
118
-        if($string !== '')
118
+        if ($string !== '')
119 119
         {
120 120
             $this->attributes[$name] = $string;
121 121
         }
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
     {
135 135
         $this->attr($name, $value);
136 136
 
137
-        if(isset($this->attributes[$name]))
137
+        if (isset($this->attributes[$name]))
138 138
         {
139 139
             $this->attributes[$name] = Filtering::quotes($this->attributes[$name]);
140 140
         }
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 
150 150
     public function remove(string $name) : AttributeCollection
151 151
     {
152
-        if(isset($this->attributes[$name]))
152
+        if (isset($this->attributes[$name]))
153 153
         {
154 154
             unset($this->attributes[$name]);
155 155
         }
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 
177 177
     private function getRenderer() : AttributesRenderer
178 178
     {
179
-        if(!isset($this->renderer))
179
+        if (!isset($this->renderer))
180 180
         {
181 181
             $this->renderer = new AttributesRenderer($this);
182 182
         }
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 
238 238
     public const TARGET_BLANK = '_blank';
239 239
 
240
-    public function target(string $value=self::TARGET_BLANK) : AttributeCollection
240
+    public function target(string $value = self::TARGET_BLANK) : AttributeCollection
241 241
     {
242 242
         return $this->attr('target', $value);
243 243
     }
Please login to merge, or discard this patch.
src/StyleCollection.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     /**
34 34
      * @param array<string,string|number|NumberInfo|Interface_Stringable|NULL> $styles
35 35
      */
36
-    public function __construct(array $styles=array())
36
+    public function __construct(array $styles = array())
37 37
     {
38 38
         $this->options = new StyleOptions();
39 39
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
      * @param array<string,string|number|NumberInfo|Interface_Stringable|NULL> $styles
45 45
      * @return StyleCollection
46 46
      */
47
-    public static function create(array $styles=array()) : StyleCollection
47
+    public static function create(array $styles = array()) : StyleCollection
48 48
     {
49 49
         return new StyleCollection($styles);
50 50
     }
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     {
69 69
         $lines = explode(';', $string);
70 70
 
71
-        foreach($lines as $line)
71
+        foreach ($lines as $line)
72 72
         {
73 73
             $parts = explode(':', $line);
74 74
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
      */
90 90
     public function setStyles(array $styles) : StyleCollection
91 91
     {
92
-        foreach($styles as $name => $value)
92
+        foreach ($styles as $name => $value)
93 93
         {
94 94
             $this->styleAuto($name, $value);
95 95
         }
@@ -105,14 +105,14 @@  discard block
 block discarded – undo
105 105
      * @param bool $important
106 106
      * @return $this
107 107
      */
108
-    public function style(string $name, string $value, bool $important=false) : StyleCollection
108
+    public function style(string $name, string $value, bool $important = false) : StyleCollection
109 109
     {
110
-        if($value === '')
110
+        if ($value === '')
111 111
         {
112 112
             return $this;
113 113
         }
114 114
 
115
-        if($important && stripos($value, '!important') === false)
115
+        if ($important && stripos($value, '!important') === false)
116 116
         {
117 117
             $value .= ' !important';
118 118
         }
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
      * @param bool $important
131 131
      * @return $this
132 132
      */
133
-    public function styleAuto(string $name, $value, bool $important=false) : StyleCollection
133
+    public function styleAuto(string $name, $value, bool $important = false) : StyleCollection
134 134
     {
135
-        if($value instanceof NumberInfo)
135
+        if ($value instanceof NumberInfo)
136 136
         {
137 137
             return $this->style($name, $value->toCSS(), $important);
138 138
         }
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
         return $this->style($name, (string)$value, $important);
141 141
     }
142 142
 
143
-    public function stylePX(string $name, int $px, bool $important=false) : StyleCollection
143
+    public function stylePX(string $name, int $px, bool $important = false) : StyleCollection
144 144
     {
145 145
         return $this->style($name, $px.'px', $important);
146 146
     }
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
      * @param bool $important
170 170
      * @return $this
171 171
      */
172
-    public function styleParseNumber(string $name, $value, bool $important=false) : StyleCollection
172
+    public function styleParseNumber(string $name, $value, bool $important = false) : StyleCollection
173 173
     {
174 174
         return $this->styleNumber($name, parseNumber($value), $important);
175 175
     }
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
      * @param bool $important
183 183
      * @return $this
184 184
      */
185
-    public function styleNumber(string $name, NumberInfo $info, bool $important=false) : StyleCollection
185
+    public function styleNumber(string $name, NumberInfo $info, bool $important = false) : StyleCollection
186 186
     {
187 187
         $this->style($name, $info->toCSS(), $important);
188 188
         return $this;
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 
191 191
     public function remove(string $name) : StyleCollection
192 192
     {
193
-        if(isset($this->styles[$name]))
193
+        if (isset($this->styles[$name]))
194 194
         {
195 195
             unset($this->styles[$name]);
196 196
         }
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
     {
227 227
         $all = self::create();
228 228
 
229
-        foreach($collections as $collection)
229
+        foreach ($collections as $collection)
230 230
         {
231 231
             $all->mergeWith($collection);
232 232
         }
Please login to merge, or discard this patch.
src/IniHelper.php 1 patch
Indentation   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -60,23 +60,23 @@  discard block
 block discarded – undo
60 60
         }
61 61
     }
62 62
     
63
-   /**
64
-    * The end of line character used in the INI source string.
65
-    * @return string
66
-    */
63
+    /**
64
+     * The end of line character used in the INI source string.
65
+     * @return string
66
+     */
67 67
     public function getEOLChar() : string
68 68
     {
69 69
         return $this->eol;
70 70
     }
71 71
     
72
-   /**
73
-    * Factory method: creates a new helper instance loading the
74
-    * ini content from the specified file.
75
-    * 
76
-    * @param string $iniPath
77
-    * @return \AppUtils\IniHelper
78
-    * @throws IniHelper_Exception
79
-    */
72
+    /**
73
+     * Factory method: creates a new helper instance loading the
74
+     * ini content from the specified file.
75
+     * 
76
+     * @param string $iniPath
77
+     * @return \AppUtils\IniHelper
78
+     * @throws IniHelper_Exception
79
+     */
80 80
     public static function createFromFile(string $iniPath)
81 81
     {
82 82
         $iniPath = FileHelper::requireFileExists($iniPath);
@@ -96,35 +96,35 @@  discard block
 block discarded – undo
96 96
         );
97 97
     }
98 98
     
99
-   /**
100
-    * Factory method: Creates a new ini helper instance from an ini string.
101
-    * 
102
-    * @param string $iniContent
103
-    * @return \AppUtils\IniHelper
104
-    */
99
+    /**
100
+     * Factory method: Creates a new ini helper instance from an ini string.
101
+     * 
102
+     * @param string $iniContent
103
+     * @return \AppUtils\IniHelper
104
+     */
105 105
     public static function createFromString(string $iniContent)
106 106
     {
107 107
         return new IniHelper($iniContent);
108 108
     }
109 109
     
110
-   /**
111
-    * Factory method: Creates a new empty ini helper.
112
-    *  
113
-    * @return \AppUtils\IniHelper
114
-    */
110
+    /**
111
+     * Factory method: Creates a new empty ini helper.
112
+     *  
113
+     * @return \AppUtils\IniHelper
114
+     */
115 115
     public static function createNew()
116 116
     {
117 117
         return self::createFromString('');
118 118
     }
119 119
     
120
-   /**
121
-    * Adds a new data section, and returns the section instance.
122
-    * If a section with the name already exists, returns that
123
-    * section instead of creating a new one.
124
-    *  
125
-    * @param string $name
126
-    * @return IniHelper_Section
127
-    */
120
+    /**
121
+     * Adds a new data section, and returns the section instance.
122
+     * If a section with the name already exists, returns that
123
+     * section instead of creating a new one.
124
+     *  
125
+     * @param string $name
126
+     * @return IniHelper_Section
127
+     */
128 128
     public function addSection(string $name) : IniHelper_Section
129 129
     {
130 130
         if(!isset($this->sections[$name])) {
@@ -134,12 +134,12 @@  discard block
 block discarded – undo
134 134
         return $this->sections[$name];
135 135
     }
136 136
     
137
-   /**
138
-    * Retrieves a section by its name, if it exists.
139
-    * 
140
-    * @param string $name
141
-    * @return IniHelper_Section|NULL
142
-    */
137
+    /**
138
+     * Retrieves a section by its name, if it exists.
139
+     * 
140
+     * @param string $name
141
+     * @return IniHelper_Section|NULL
142
+     */
143 143
     public function getSection(string $name) : ?IniHelper_Section
144 144
     {
145 145
         if(isset($this->sections[$name])) {
@@ -149,11 +149,11 @@  discard block
 block discarded – undo
149 149
         return null;
150 150
     }
151 151
     
152
-   /**
153
-    * Gets the data from the INI file as an associative array.
154
-    * 
155
-    * @return array
156
-    */
152
+    /**
153
+     * Gets the data from the INI file as an associative array.
154
+     * 
155
+     * @return array
156
+     */
157 157
     public function toArray() : array
158 158
     {
159 159
         $result = array();
@@ -173,17 +173,17 @@  discard block
 block discarded – undo
173 173
         return $result;
174 174
     }
175 175
     
176
-   /**
177
-    * Saves the INI content to the target file.
178
-    * 
179
-    * @param string $filePath
180
-    * @return IniHelper
181
-    * @throws FileHelper_Exception
182
-    * 
183
-    * @see FileHelper::ERROR_SAVE_FOLDER_NOT_WRITABLE
184
-    * @see FileHelper::ERROR_SAVE_FILE_NOT_WRITABLE
185
-    * @see FileHelper::ERROR_SAVE_FILE_WRITE_FAILED
186
-    */
176
+    /**
177
+     * Saves the INI content to the target file.
178
+     * 
179
+     * @param string $filePath
180
+     * @return IniHelper
181
+     * @throws FileHelper_Exception
182
+     * 
183
+     * @see FileHelper::ERROR_SAVE_FOLDER_NOT_WRITABLE
184
+     * @see FileHelper::ERROR_SAVE_FILE_NOT_WRITABLE
185
+     * @see FileHelper::ERROR_SAVE_FILE_WRITE_FAILED
186
+     */
187 187
     public function saveToFile(string $filePath) : IniHelper
188 188
     {
189 189
         FileHelper::saveFile($filePath, $this->saveToString());
@@ -191,11 +191,11 @@  discard block
 block discarded – undo
191 191
         return $this;
192 192
     }
193 193
     
194
-   /**
195
-    * Returns the INI content as string.
196
-    * 
197
-    * @return string
198
-    */
194
+    /**
195
+     * Returns the INI content as string.
196
+     * 
197
+     * @return string
198
+     */
199 199
     public function saveToString() : string
200 200
     {
201 201
         $parts = array();
@@ -208,15 +208,15 @@  discard block
 block discarded – undo
208 208
         return implode($this->eol, $parts);
209 209
     }
210 210
     
211
-   /**
212
-    * Sets or adds the value of a setting in the INI content.
213
-    * If the setting does not exist, it is added. Otherwise,
214
-    * the existing value is overwritten.
215
-    * 
216
-    * @param string $path A variable path, either <code>varname</code> or <code>section.varname</code>.
217
-    * @param mixed $value
218
-    * @return IniHelper
219
-    */
211
+    /**
212
+     * Sets or adds the value of a setting in the INI content.
213
+     * If the setting does not exist, it is added. Otherwise,
214
+     * the existing value is overwritten.
215
+     * 
216
+     * @param string $path A variable path, either <code>varname</code> or <code>section.varname</code>.
217
+     * @param mixed $value
218
+     * @return IniHelper
219
+     */
220 220
     public function setValue(string $path, $value) : IniHelper
221 221
     {
222 222
         $path = $this->parsePath($path);
@@ -235,12 +235,12 @@  discard block
 block discarded – undo
235 235
         return $this;
236 236
     }
237 237
     
238
-   /**
239
-    * Checks whether a section with the specified name exists.
240
-    * 
241
-    * @param string $name
242
-    * @return bool
243
-    */
238
+    /**
239
+     * Checks whether a section with the specified name exists.
240
+     * 
241
+     * @param string $name
242
+     * @return bool
243
+     */
244 244
     public function sectionExists(string $name) : bool
245 245
     {
246 246
         foreach($this->sections as $section) {
@@ -252,23 +252,23 @@  discard block
 block discarded – undo
252 252
         return false;
253 253
     }
254 254
     
255
-   /**
256
-    * Retrieves the default section, which is used to add
257
-    * values in the root of the document.
258
-    * 
259
-    * @return IniHelper_Section
260
-    */
255
+    /**
256
+     * Retrieves the default section, which is used to add
257
+     * values in the root of the document.
258
+     * 
259
+     * @return IniHelper_Section
260
+     */
261 261
     public function getDefaultSection() : IniHelper_Section
262 262
     {
263 263
         return $this->addSection(self::SECTION_DEFAULT);
264 264
     }
265 265
     
266
-   /**
267
-    * Retrieves all variable lines for the specified path.
268
-    * 
269
-    * @param string $path A variable path. Either <code>varname</code> or <code>section.varname</code>.
270
-    * @return array|\AppUtils\IniHelper_Line[]
271
-    */
266
+    /**
267
+     * Retrieves all variable lines for the specified path.
268
+     * 
269
+     * @param string $path A variable path. Either <code>varname</code> or <code>section.varname</code>.
270
+     * @return array|\AppUtils\IniHelper_Line[]
271
+     */
272 272
     public function getLinesByVariable(string $path)
273 273
     {
274 274
         $path = $this->parsePath($path);
Please login to merge, or discard this patch.
src/RGBAColor.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -339,7 +339,7 @@
 block discarded – undo
339 339
      */
340 340
     private function requireValidComponent(string $name) : void
341 341
     {
342
-        if(in_array($name, self::COLOR_COMPONENTS))
342
+        if (in_array($name, self::COLOR_COMPONENTS))
343 343
         {
344 344
             return;
345 345
         }
Please login to merge, or discard this patch.
src/Traits/Classable.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
      */
42 42
     public function addClass(string $name)
43 43
     {
44
-        if(!in_array($name, $this->classes)) {
44
+        if (!in_array($name, $this->classes)) {
45 45
             $this->classes[] = $name;
46 46
         }
47 47
         
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      */
55 55
     public function addClasses(array $names)
56 56
     {
57
-        foreach($names as $name) {
57
+        foreach ($names as $name) {
58 58
             $this->addClass($name);
59 59
         }
60 60
         
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     {
75 75
         $idx = array_search($name, $this->classes);
76 76
         
77
-        if($idx !== false) {
77
+        if ($idx !== false) {
78 78
             unset($this->classes[$idx]);
79 79
             sort($this->classes);
80 80
         }
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
     */
109 109
     public function classesToAttribute() : string
110 110
     {
111
-        if(!empty($this->classes))
111
+        if (!empty($this->classes))
112 112
         {
113 113
             return sprintf(
114 114
                 ' class="%s" ',
Please login to merge, or discard this patch.
src/Traits/Attributable.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
      * @param bool $enabled
53 53
      * @return $this
54 54
      */
55
-    public function prop(string $name, bool $enabled=true)
55
+    public function prop(string $name, bool $enabled = true)
56 56
     {
57 57
         $this->getAttributes()->prop($name, $enabled);
58 58
         return $this;
Please login to merge, or discard this patch.
src/AttributeCollection/Filtering.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -56,11 +56,11 @@
 block discarded – undo
56 56
      */
57 57
     public static function value2string($value) : string
58 58
     {
59
-        if($value === true)
59
+        if ($value === true)
60 60
         {
61 61
             return 'true';
62 62
         }
63
-        else if($value === false)
63
+        else if ($value === false)
64 64
         {
65 65
             return 'false';
66 66
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -59,8 +59,7 @@
 block discarded – undo
59 59
         if($value === true)
60 60
         {
61 61
             return 'true';
62
-        }
63
-        else if($value === false)
62
+        } else if($value === false)
64 63
         {
65 64
             return 'false';
66 65
         }
Please login to merge, or discard this patch.
src/AttributeCollection/AttributesRenderer.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -24,14 +24,14 @@  discard block
 block discarded – undo
24 24
 
25 25
         $attributes = $this->compileAttributes();
26 26
 
27
-        if(empty($attributes))
27
+        if (empty($attributes))
28 28
         {
29 29
             return '';
30 30
         }
31 31
 
32
-        foreach($attributes as $name => $value)
32
+        foreach ($attributes as $name => $value)
33 33
         {
34
-            if($value === '')
34
+            if ($value === '')
35 35
             {
36 36
                 continue;
37 37
             }
@@ -53,12 +53,12 @@  discard block
 block discarded – undo
53 53
     {
54 54
         $attributes = $this->collection->getRawAttributes();
55 55
 
56
-        if($this->collection->hasClasses())
56
+        if ($this->collection->hasClasses())
57 57
         {
58 58
             $attributes['class'] = $this->collection->classesToString();
59 59
         }
60 60
 
61
-        if($this->collection->hasStyles())
61
+        if ($this->collection->hasStyles())
62 62
         {
63 63
             $attributes['style'] = $this->collection->getStyles()
64 64
                 ->configureForInline()
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 
71 71
     private function renderAttribute(string $name, string $value) : string
72 72
     {
73
-        if($name === $value)
73
+        if ($name === $value)
74 74
         {
75 75
             return $name;
76 76
         }
Please login to merge, or discard this patch.
src/StyleCollection/StylesRenderer.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 
27 27
     public function render() : string
28 28
     {
29
-        if($this->collection->hasStyles())
29
+        if ($this->collection->hasStyles())
30 30
         {
31 31
             return implode(
32 32
                 $this->resolveSeparator(),
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 
40 40
     private function resolveSuffix() : string
41 41
     {
42
-        if($this->options->isTrailingSemicolonEnabled())
42
+        if ($this->options->isTrailingSemicolonEnabled())
43 43
         {
44 44
             return ';';
45 45
         }
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
     private function resolveSeparator() : string
51 51
     {
52
-        if($this->options->isNewlineEnabled())
52
+        if ($this->options->isNewlineEnabled())
53 53
         {
54 54
             return ';'.PHP_EOL;
55 55
         }
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
     {
62 62
         $indentLevel = $this->options->getIndentLevel();
63 63
 
64
-        if($indentLevel > 0)
64
+        if ($indentLevel > 0)
65 65
         {
66 66
             return str_repeat($this->options->getIndentChar(), $indentLevel);
67 67
         }
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 
72 72
     private function resolveValueSpace() : string
73 73
     {
74
-        if($this->options->isSpaceBeforeValueEnabled())
74
+        if ($this->options->isSpaceBeforeValueEnabled())
75 75
         {
76 76
             return ' ';
77 77
         }
@@ -86,12 +86,12 @@  discard block
 block discarded – undo
86 86
         $indent = $this->resolveIndent();
87 87
         $valueSpace = $this->resolveValueSpace();
88 88
 
89
-        if($this->options->isSortingEnabled())
89
+        if ($this->options->isSortingEnabled())
90 90
         {
91 91
             ksort($styles);
92 92
         }
93 93
 
94
-        foreach($styles as $name => $value)
94
+        foreach ($styles as $name => $value)
95 95
         {
96 96
             $lines[] = sprintf(
97 97
                 '%s%s:%s%s',
Please login to merge, or discard this patch.