Passed
Push — main ( 39217e...f51ec7 )
by Sammy
07:12
created
src/Form.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -17,10 +17,10 @@  discard block
 block discarded – undo
17 17
     {
18 18
       // arguments [name, value, [attributes], [errors]]
19 19
         $i = 0;
20
-        $field_name =  $arguments[$i++] ?? null;
20
+        $field_name = $arguments[$i++] ?? null;
21 21
         $field_value = $arguments[$i++] ?? null;
22
-        $attributes =  (array)($arguments[$i++] ?? []);
23
-        $errors =      (array)($arguments[$i++] ?? []);
22
+        $attributes = (array)($arguments[$i++] ?? []);
23
+        $errors = (array)($arguments[$i++] ?? []);
24 24
 
25 25
         $attributes['type'] = $element_type;
26 26
         $attributes['name'] = $attributes['name'] ?? $field_name;
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
         foreach ($option_list as $value => $label) {
69 69
             $option_attributes = ['value' => $value];
70 70
             if ($selected == $value) {
71
-                $option_attributes['selected'] =  'selected';
71
+                $option_attributes['selected'] = 'selected';
72 72
             }
73 73
 
74 74
             $options .= new Element('option', $label, $option_attributes);
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 
79 79
     public static function legend(string $label, array $attributes = []): string
80 80
     {
81
-        return '' . (new Element('legend', $label, $attributes));
81
+        return ''.(new Element('legend', $label, $attributes));
82 82
     }
83 83
 
84 84
     public static function label(string $field_for, string $field_label, array $attributes = [], array $errors = []): string
@@ -128,6 +128,6 @@  discard block
 block discarded – undo
128 128
             unset($attributes['label']);
129 129
         }
130 130
 
131
-        return $label . (new Element($tag, $content, $attributes));
131
+        return $label.(new Element($tag, $content, $attributes));
132 132
     }
133 133
 }
Please login to merge, or discard this patch.
tests/ElementTest.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
 
25 25
   public function testCreateEmptyElement(): void
26 26
   {
27
-    foreach($this->tags as $tag)
27
+    foreach ($this->tags as $tag)
28 28
     {
29 29
       $e = new Element($tag);
30
-      if(in_array($tag, Element::VOID_ELEMENTS)){
30
+      if (in_array($tag, Element::VOID_ELEMENTS)) {
31 31
         $this->assertEquals('<'.$tag.'/>', $e->__toString());
32 32
       }
33 33
       else {
@@ -40,12 +40,12 @@  discard block
 block discarded – undo
40 40
   public function testCreateElementWithContent(): void
41 41
   {
42 42
     $messages = ['lorem ipsum' => 'lorem ipsum', '' => '', null => ''];
43
-    foreach($messages as $message => $expected){
44
-      foreach($this->tags as $tag)
43
+    foreach ($messages as $message => $expected) {
44
+      foreach ($this->tags as $tag)
45 45
       {
46 46
         $e = new Element($tag, $message);
47 47
 
48
-        if(in_array($tag, Element::VOID_ELEMENTS)){
48
+        if (in_array($tag, Element::VOID_ELEMENTS)) {
49 49
           $this->assertEquals('<'.$tag.'/>', $e->__toString());
50 50
         }
51 51
         else {
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
     $this->assertForAllHTMLTags($message, $attributes, $attributes_expected_string);
97 97
 
98 98
 
99
-    $attributes = ['class' => 'test_class', 'style="color:red;"','id' => 'test_id'];
99
+    $attributes = ['class' => 'test_class', 'style="color:red;"', 'id' => 'test_id'];
100 100
     $attributes_expected_string = ' class="test_class" style="color:red;" id="test_id"';
101 101
 
102 102
     // testing attributes string generator
@@ -109,11 +109,11 @@  discard block
 block discarded – undo
109 109
 
110 110
   private function assertForAllHTMLTags($message, $attributes, $attributes_expected_string)
111 111
   {
112
-    foreach($this->tags as $tag){
112
+    foreach ($this->tags as $tag) {
113 113
 
114 114
       // testing by instantiation
115
-      $e = new Element($tag, $message,  $attributes);
116
-      if(in_array($tag, Element::VOID_ELEMENTS)){
115
+      $e = new Element($tag, $message, $attributes);
116
+      if (in_array($tag, Element::VOID_ELEMENTS)) {
117 117
         $this->assertEquals(sprintf(Element::FORMAT_VOID, $tag, $attributes_expected_string), $e->__toString());
118 118
       }
119 119
       else {
Please login to merge, or discard this patch.