Passed
Push — main ( f09874...08f4c3 )
by Sammy
07:02
created
src/Marker.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 /**
4
-  * HTML generator
5
-  * Marker, hommage to Christian François Bouche-Villeneuve aka Chris Marker
6
-  */
4
+ * HTML generator
5
+ * Marker, hommage to Christian François Bouche-Villeneuve aka Chris Marker
6
+ */
7 7
 
8 8
 declare(strict_types=1);
9 9
 
@@ -12,11 +12,11 @@  discard block
 block discarded – undo
12 12
 class Marker extends Element
13 13
 {
14 14
     /**
15
-      * ? smoother write
16
-      * Marker::img('path/to/img.jpg', 'An alternative text', ['width' => 34, 'height' => 34])
17
-      * than
18
-      * Element::img(null, ['src' => 'path/to/img.jpg', 'alt' => 'An alternative text', 'width' => 34, 'height' => 34])
19
-      */
15
+     * ? smoother write
16
+     * Marker::img('path/to/img.jpg', 'An alternative text', ['width' => 34, 'height' => 34])
17
+     * than
18
+     * Element::img(null, ['src' => 'path/to/img.jpg', 'alt' => 'An alternative text', 'width' => 34, 'height' => 34])
19
+     */
20 20
     public static function img(string $src, string $alt, array $attributes = []): Element
21 21
     {
22 22
         $attributes['src'] ??= $src;
@@ -27,11 +27,11 @@  discard block
 block discarded – undo
27 27
     }
28 28
 
29 29
     /**
30
-      * ? makes more sense to write
31
-      * Marker::a('controller/task/id', 'Click here', ['class' => 'nav'])
32
-      * than
33
-      * Marker::a('Click here', ['href' => controller/task/id', 'class' => 'nav'])
34
-      */
30
+     * ? makes more sense to write
31
+     * Marker::a('controller/task/id', 'Click here', ['class' => 'nav'])
32
+     * than
33
+     * Marker::a('Click here', ['href' => controller/task/id', 'class' => 'nav'])
34
+     */
35 35
     public static function a(string $href, string $label, array $attributes = []): Element
36 36
     {
37 37
         $attributes['href'] ??= $href;
Please login to merge, or discard this patch.
src/Element.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
     {
37 37
         $this->tag = $tag;
38 38
         $this->inner = $inner;
39
-        foreach($attributes as $name => $value)
39
+        foreach ($attributes as $name => $value)
40 40
         {
41 41
             // is boolean attribute ?
42
-            if(is_int($name))
42
+            if (is_int($name))
43 43
             {
44 44
                 $this->$value = true;
45 45
             }
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
             }
50 50
         }
51 51
 
52
-        $this->formatter = $formatter ?? function($value){
52
+        $this->formatter = $formatter ?? function($value) {
53 53
             return htmlspecialchars($value, ENT_QUOTES);
54 54
         };
55 55
     }
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
         
83 83
         foreach ($this->attributes as $name => $value) {
84 84
             $name = call_user_func($this->formatter, $name);
85
-            $attributes .= ' ' . ($value === true ? $name : sprintf('%s="%s"', $name, call_user_func($this->formatter, (string)$value)));
85
+            $attributes .= ' '.($value === true ? $name : sprintf('%s="%s"', $name, call_user_func($this->formatter, (string)$value)));
86 86
         }
87 87
 
88 88
         return $this->inner === null
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,8 +42,7 @@
 block discarded – undo
42 42
             if(is_int($name))
43 43
             {
44 44
                 $this->$value = true;
45
-            }
46
-            else
45
+            } else
47 46
             {
48 47
                 $this->$name = $value;
49 48
             }
Please login to merge, or discard this patch.
src/Form.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
         foreach ($list as $value => $label) {
108 108
             $option_attributes = ['value' => $value];
109 109
             if ($selected == $value) {
110
-                $option_attributes['selected'] =  'selected';
110
+                $option_attributes['selected'] = 'selected';
111 111
             }
112 112
 
113 113
             $options .= new Element('option', "$label", $option_attributes);
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
      */
126 126
     public static function legend(string $label, array $attributes = []): string
127 127
     {
128
-        return '' . (new Element('legend', $label, $attributes));
128
+        return ''.(new Element('legend', $label, $attributes));
129 129
     }
130 130
 
131 131
     /**
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 
147 147
     public static function button(string $label, array $attributes = []): string
148 148
     {
149
-        return  '' . (new Element('button', $label, $attributes));
149
+        return  ''.(new Element('button', $label, $attributes));
150 150
     }
151 151
 
152 152
     /**
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 = 
202 202
         $input = new Element($tag, $content, $attributes);
203 203
 
204
-        if($label_text){
204
+        if ($label_text) {
205 205
             if (!empty($attributes['label-wrap']))
206 206
                 $ret = self::label(null, $label_text.$input);
207 207
             else
Please login to merge, or discard this patch.
Braces   +7 added lines, -6 removed lines patch added patch discarded remove patch
@@ -202,13 +202,14 @@
 block discarded – undo
202 202
         $input = new Element($tag, $content, $attributes);
203 203
 
204 204
         if($label_text){
205
-            if (!empty($attributes['label-wrap']))
206
-                $ret = self::label(null, $label_text.$input);
207
-            else
208
-                $ret = self::label($attributes['id'], $label_text).$input;
205
+            if (!empty($attributes['label-wrap'])) {
206
+                            $ret = self::label(null, $label_text.$input);
207
+            } else {
208
+                            $ret = self::label($attributes['id'], $label_text).$input;
209
+            }
210
+        } else {
211
+                    $ret = $input;
209 212
         }
210
-        else
211
-            $ret = $input;
212 213
 
213 214
         return $ret;
214 215
     }
Please login to merge, or discard this patch.
src/WCAGElement.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      * @param array  $attributes Additional attributes
66 66
      * @return string
67 67
      */
68
-    public static function img(string $src, string $alt='', $attributes = [])
68
+    public static function img(string $src, string $alt = '', $attributes = [])
69 69
     {
70 70
         $attributes['src'] = $src;
71 71
         $attributes['alt'] = $alt;
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 
89 89
         $content .= parent::figcaption($caption);
90 90
         $attributes['role'] = 'figure';
91
-        return parent::figure($content, $attributes, function ($value) {
91
+        return parent::figure($content, $attributes, function($value) {
92 92
             return $value;
93 93
         });
94 94
     }
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
      */
119 119
     public static function audio(string $src, $attributes = [])
120 120
     {
121
-        if(empty($src)) {
121
+        if (empty($src)) {
122 122
             throw new \InvalidArgumentException("Source attribute is required");
123 123
         }
124 124
 
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
      */
151 151
     public static function iframe(string $src, string $title, $attributes = [])
152 152
     {
153
-        if(empty($title)) {
153
+        if (empty($title)) {
154 154
             throw new \InvalidArgumentException("Iframe title is required");
155 155
         }
156 156
 
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
      */
167 167
     public static function a(string $href, string $content, $attributes = [])
168 168
     {
169
-        if(empty($href)) {
169
+        if (empty($href)) {
170 170
             throw new \InvalidArgumentException("Anchor href is required");
171 171
         }
172 172
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
      */
182 182
     public static function area(string $alt, $attributes = [])
183 183
     {
184
-        if(empty($alt)) {
184
+        if (empty($alt)) {
185 185
             throw new \InvalidArgumentException("Area alt is required");
186 186
         }
187 187
         $attributes['alt'] = $alt;
@@ -195,18 +195,18 @@  discard block
 block discarded – undo
195 195
      */
196 196
     public static function input(string $type, string $name, $attributes = [])
197 197
     {
198
-        if(empty($type)) {
198
+        if (empty($type)) {
199 199
             throw new \InvalidArgumentException("Input type is required");
200 200
         }
201 201
 
202
-        if(empty($name)) {
202
+        if (empty($name)) {
203 203
             throw new \InvalidArgumentException("Input name is required");
204 204
         }
205 205
 
206 206
         $attributes['name'] = $name;
207 207
         $attributes['type'] = $type;
208 208
 
209
-        if(self::inputIsRequired($attributes)) {
209
+        if (self::inputIsRequired($attributes)) {
210 210
             $attributes['aria-required'] = 'true';
211 211
         }
212 212
 
@@ -230,10 +230,10 @@  discard block
 block discarded – undo
230 230
         }
231 231
         $attributes['name'] = $name;
232 232
         $string_options = '';
233
-        foreach($options as $value => $label) {
234
-            $string_options.= parent::option($label, ['value' => $value]);
233
+        foreach ($options as $value => $label) {
234
+            $string_options .= parent::option($label, ['value' => $value]);
235 235
         }
236
-        return parent::select($string_options, $attributes, function ($value) {
236
+        return parent::select($string_options, $attributes, function($value) {
237 237
             return $value;
238 238
         });
239 239
     }
@@ -271,11 +271,11 @@  discard block
 block discarded – undo
271 271
      */
272 272
     public static function html(string $content, $attributes = [])
273 273
     {
274
-        if(empty($content)) {
274
+        if (empty($content)) {
275 275
             throw new \InvalidArgumentException("HTML content is required");
276 276
         }
277 277
 
278
-        if(empty($attributes['lang'])) {
278
+        if (empty($attributes['lang'])) {
279 279
             throw new \InvalidArgumentException("Language attribute is required");
280 280
         }
281 281
         return parent::html($content, $attributes);
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
      */
289 289
     public static function th(string $scope, string $content, $attributes = [])
290 290
     {
291
-        if(empty($scope)) {
291
+        if (empty($scope)) {
292 292
             throw new \InvalidArgumentException("Scope attribute is required");
293 293
         }
294 294
 
Please login to merge, or discard this patch.