Passed
Push — main ( 5c15a6...ae0e18 )
by Sammy
01:48
created
tests/ElementTest.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -23,11 +23,11 @@  discard block
 block discarded – undo
23 23
 
24 24
   public function testCreateEmptyElement(): void
25 25
   {
26
-    foreach($this->tags as $tag)
26
+    foreach ($this->tags as $tag)
27 27
     {
28 28
       $e = new Element($tag);
29 29
 
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 {
@@ -43,12 +43,12 @@  discard block
 block discarded – undo
43 43
   public function testCreateElementWithContent(): void
44 44
   {
45 45
     $messages = ['lorem ipsum' => 'lorem ipsum', '' => '', null => ''];
46
-    foreach($messages as $message => $expected){
47
-      foreach($this->tags as $tag)
46
+    foreach ($messages as $message => $expected) {
47
+      foreach ($this->tags as $tag)
48 48
       {
49 49
         $e = new Element($tag, $message);
50 50
 
51
-        if(in_array($tag, Element::VOID_ELEMENTS)){
51
+        if (in_array($tag, Element::VOID_ELEMENTS)) {
52 52
           $this->assertEquals('<'.$tag.'/>', $e->__toString());
53 53
         }
54 54
         else {
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
     $this->assertForAllHTMLTags($message, $attributes, $attributes_expected_string);
103 103
 
104 104
 
105
-    $attributes = ['class' => 'test_class', 'style="color:red;"','id' => 'test_id'];
105
+    $attributes = ['class' => 'test_class', 'style="color:red;"', 'id' => 'test_id'];
106 106
     $attributes_expected_string = ' class="test_class" style="color:red;" id="test_id"';
107 107
 
108 108
     // testing attributes string generator
@@ -115,11 +115,11 @@  discard block
 block discarded – undo
115 115
 
116 116
   private function assertForAllHTMLTags($message, $attributes, $attributes_expected_string)
117 117
   {
118
-    foreach($this->tags as $tag){
118
+    foreach ($this->tags as $tag) {
119 119
 
120 120
       // testing by instantiation
121
-      $e = new Element($tag, $message,  $attributes);
122
-      if(in_array($tag, Element::VOID_ELEMENTS)){
121
+      $e = new Element($tag, $message, $attributes);
122
+      if (in_array($tag, Element::VOID_ELEMENTS)) {
123 123
         $this->assertEquals(sprintf(Element::FORMAT_VOID, $tag, $attributes_expected_string), $e->__toString());
124 124
       }
125 125
       else {
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
       }
128 128
 
129 129
       // testing by callStatic();
130
-      $e_stat = Element::$tag($message,  $attributes);
130
+      $e_stat = Element::$tag($message, $attributes);
131 131
       $this->assertEquals($e_stat, $e->__toString());
132 132
     }
133 133
   }
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,8 +29,7 @@  discard block
 block discarded – undo
29 29
 
30 30
       if(in_array($tag, Element::VOID_ELEMENTS)){
31 31
         $this->assertEquals('<'.$tag.'/>', $e->__toString());
32
-      }
33
-      else {
32
+      } else {
34 33
         $this->assertEquals("<$tag></$tag>", $e->__toString());
35 34
       }
36 35
 
@@ -50,8 +49,7 @@  discard block
 block discarded – undo
50 49
 
51 50
         if(in_array($tag, Element::VOID_ELEMENTS)){
52 51
           $this->assertEquals('<'.$tag.'/>', $e->__toString());
53
-        }
54
-        else {
52
+        } else {
55 53
           $this->assertEquals("<$tag>$expected</$tag>", $e->__toString());
56 54
         }
57 55
 
@@ -121,8 +119,7 @@  discard block
 block discarded – undo
121 119
       $e = new Element($tag, $message,  $attributes);
122 120
       if(in_array($tag, Element::VOID_ELEMENTS)){
123 121
         $this->assertEquals(sprintf(Element::FORMAT_VOID, $tag, $attributes_expected_string), $e->__toString());
124
-      }
125
-      else {
122
+      } else {
126 123
         $this->assertEquals(sprintf(Element::FORMAT_ELEMENT, $tag, $attributes_expected_string, $message, $tag), $e->__toString());
127 124
       }
128 125
 
Please login to merge, or discard this patch.
src/Element.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -204,7 +204,7 @@
 block discarded – undo
204 204
         $ret = '';
205 205
         foreach ($attributes as $k => $v) {
206 206
             if (self::isValidValue($v)) {
207
-                $ret .=  ' ' . (self::isBooleanAttribute($k) ? $v : sprintf(self::FORMAT_ATTRIBUTES, $k, $v));
207
+                $ret .= ' '.(self::isBooleanAttribute($k) ? $v : sprintf(self::FORMAT_ATTRIBUTES, $k, $v));
208 208
             }
209 209
         }
210 210
         return $ret;
Please login to merge, or discard this patch.