@@ -170,7 +170,7 @@ |
||
170 | 170 | return |
171 | 171 | Marker::div( |
172 | 172 | Marker::label( |
173 | - Form::input($field_name, $field_value, $attributes) . Marker::span($field_label), |
|
173 | + Form::input($field_name, $field_value, $attributes).Marker::span($field_label), |
|
174 | 174 | ['for' => $attributes['id']] |
175 | 175 | ), |
176 | 176 | ['class' => 'checkbutton'] |
@@ -12,10 +12,10 @@ discard block |
||
12 | 12 | { |
13 | 13 | // arguments [name, value, [attributes], [errors]] |
14 | 14 | $i = 0; |
15 | - $field_name = $arguments[$i++] ?? null; |
|
15 | + $field_name = $arguments[$i++] ?? null; |
|
16 | 16 | $field_value = $arguments[$i++] ?? null; |
17 | - $attributes = $arguments[$i++] ?? []; |
|
18 | - $errors = $arguments[$i++] ?? []; |
|
17 | + $attributes = $arguments[$i++] ?? []; |
|
18 | + $errors = $arguments[$i++] ?? []; |
|
19 | 19 | |
20 | 20 | |
21 | 21 | $attributes['type'] = $element_type; |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | foreach ($option_list as $value => $label) { |
64 | 64 | $option_attributes = ['value' => $value]; |
65 | 65 | if ($selected == $value) { |
66 | - $option_attributes['selected'] = 'selected'; |
|
66 | + $option_attributes['selected'] = 'selected'; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | $options .= new Element('option', $label, $option_attributes); |
@@ -113,6 +113,6 @@ discard block |
||
113 | 113 | } |
114 | 114 | |
115 | 115 | // vd($attributes, $tag); |
116 | - return $label . (new Element($tag, $content, $attributes)); |
|
116 | + return $label.(new Element($tag, $content, $attributes)); |
|
117 | 117 | } |
118 | 118 | } |
@@ -23,11 +23,11 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -29,8 +29,7 @@ discard block |
||
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 |
||
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 |
||
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 |
@@ -204,7 +204,7 @@ |
||
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; |