| @@ -107,7 +107,7 @@ | ||
| 107 | 107 | $ret = ''; | 
| 108 | 108 |          foreach ($attributes as $k => $v) { | 
| 109 | 109 |              if (self::isValidValue($v)) { | 
| 110 | - $ret .= ' ' . (self::isBooleanAttribute($k) ? $v : sprintf(self::FORMAT_ATTRIBUTES, $k, $v)); | |
| 110 | + $ret .= ' '.(self::isBooleanAttribute($k) ? $v : sprintf(self::FORMAT_ATTRIBUTES, $k, $v)); | |
| 111 | 111 | } | 
| 112 | 112 | } | 
| 113 | 113 | |
| @@ -1,260 +1,260 @@ | ||
| 1 | 1 | <?php | 
| 2 | 2 | /** | 
| 3 | - * Simple and useful implementation for generating HTML elements in PHP | |
| 4 | - * The use of constants and magic methods make it easy to extend and maintain. | |
| 5 | - * The strict typing and use of namespaces also demonstrate good coding practices. | |
| 6 | - * This code defines a PHP class called "Element" that represents an HTML element. | |
| 7 | - * It includes several constants, such as a list of void elements and format strings for generating HTML code. | |
| 8 | - * The class also includes a constructor and a magic __callStatic() method that allows for creating new Element objects with a simple syntax. | |
| 9 | - * The __toString() method of the Element class generates the HTML code for the element based on its tag, attributes, and content. | |
| 10 | - * The isVoid() method determines if the element is a void element, which has no closing tag. | |
| 11 | - */ | |
| 3 | + * Simple and useful implementation for generating HTML elements in PHP | |
| 4 | + * The use of constants and magic methods make it easy to extend and maintain. | |
| 5 | + * The strict typing and use of namespaces also demonstrate good coding practices. | |
| 6 | + * This code defines a PHP class called "Element" that represents an HTML element. | |
| 7 | + * It includes several constants, such as a list of void elements and format strings for generating HTML code. | |
| 8 | + * The class also includes a constructor and a magic __callStatic() method that allows for creating new Element objects with a simple syntax. | |
| 9 | + * The __toString() method of the Element class generates the HTML code for the element based on its tag, attributes, and content. | |
| 10 | + * The isVoid() method determines if the element is a void element, which has no closing tag. | |
| 11 | + */ | |
| 12 | 12 | |
| 13 | 13 | /** | 
| 14 | - * show off @method | |
| 15 | - * | |
| 16 | - * @method string abbr(string $content, array $attr) | |
| 17 | - * creates an abbreviation or an acronym | |
| 18 | - * @method string acronym(string $content, array $attr) | |
| 19 | - * creates an acronym (not supported in HTML5. use abbr() instead) | |
| 20 | - * @method string address(string $content, array $attr) | |
| 21 | - * creates contact information for the author/owner of a document | |
| 22 | - * @method string applet(string $content, array $attr) | |
| 23 | - * creates an embedded applet | |
| 24 | - * (not supported in HTML5. use embed() or <object> instead) | |
| 25 | - * @method string area(string $content, array $attr) | |
| 26 | - * creates an area inside an image map | |
| 27 | - * @method string article(string $content, array $attr) | |
| 28 | - * creates an article | |
| 29 | - * @method string aside(string $content, array $attr) | |
| 30 | - * creates content aside from the page content | |
| 31 | - * @method string audio(string $content, array $attr) | |
| 32 | - * creates embedded sound content | |
| 33 | - * @method string b(string $content, array $attr) | |
| 34 | - * creates bold text | |
| 35 | - * @method string base(string $content, array $attr) | |
| 36 | - * creates an element that specifies the base url/target for all relative urls in a document | |
| 37 | - * @method string basefont(string $content, array $attr) | |
| 38 | - * creates an element that specifies a default color, size, and font for all text in a document | |
| 39 | - * (not supported in HTML5. use CSS instead) | |
| 40 | - * @method string bdi(string $content, array $attr) | |
| 41 | - * creates an element that isolates a part of text that might be formatted | |
| 42 | - * in a different direction from other text outside it | |
| 43 | - * @method string bdo(string $content, array $attr) | |
| 44 | - * creates an element that overrides the current text direction | |
| 45 | - * @method string big(string $content, array $attr) | |
| 46 | - * creates an element that defines big text (not supported in HTML5. use CSS instead) | |
| 47 | - * @method string blockquote(string $content, array $attr) | |
| 48 | - * creates a section that is quoted from another source | |
| 49 | - * @method string body(string $content, array $attr) | |
| 50 | - * creates the document's body | |
| 51 | - * @method string br(string $content, array $attr) | |
| 52 | - * creates a single line break | |
| 53 | - * @method string button(string $content, array $attr) | |
| 54 | - * creates a clickable button | |
| 55 | - * @method string canvas(string $content, array $attr) | |
| 56 | - * used to draw graphics, on the fly, via scripting (usually javascript) | |
| 57 | - * @method string caption(string $content, array $attr) | |
| 58 | - * creates a table caption | |
| 59 | - * @method string center(string $content, array $attr) | |
| 60 | - * defines centered text (not supported in HTML5. use CSS instead) | |
| 61 | - * @method string cite(string $content, array $attr) | |
| 62 | - * creates the title of a work | |
| 63 | - * @method string code(string $content, array $attr) | |
| 64 | - * creates a piece of computer code | |
| 65 | - * @method string col(string $content, array $attr) | |
| 66 | - * specifies column properties for each column within a <colgroup> element | |
| 67 | - * @method string colgroup(string $content, array $attr) | |
| 68 | - * specifies a group of one or more columns in a table for formatting | |
| 69 | - * @method string data(string $content, array $attr) | |
| 70 | - * adds a machine-readable translation of a given content | |
| 71 | - * @method string datalist(string $content, array $attr) | |
| 72 | - * specifies a list of pre-defined options for input controls | |
| 73 | - * @method string dd(string $content, array $attr) | |
| 74 | - * creates a description/value of a term in a description list | |
| 75 | - * @method string del(string $content, array $attr) | |
| 76 | - * creates text that has been deleted from a document | |
| 77 | - * @method string details(string $content, array $attr) | |
| 78 | - * creates additional details that the user can view or hide | |
| 79 | - * @method string dfn(string $content, array $attr) | |
| 80 | - * specifies a term that is going to be defined within the content | |
| 81 | - * @method string dialog(string $content, array $attr) | |
| 82 | - * creates a dialog box or window | |
| 83 | - * @method string dir(string $content, array $attr) | |
| 84 | - * defines a directory list (not supported in HTML5. use ul() instead) | |
| 85 | - * @method string div(string $content, array $attr) | |
| 86 | - * creates a section in a document | |
| 87 | - * @method string dl(string $content, array $attr) | |
| 88 | - * creates a description list | |
| 89 | - * @method string dt(string $content, array $attr) | |
| 90 | - * creates a term/name in a description list | |
| 91 | - * @method string em(string $content, array $attr) | |
| 92 | - * creates emphasized text | |
| 93 | - * @method string embed(string $content, array $attr) | |
| 94 | - * creates a container for an external application | |
| 95 | - * @method string fieldset(string $content, array $attr) | |
| 96 | - * groups related elements in a form | |
| 97 | - * @method string figcaption(string $content, array $attr) | |
| 98 | - * creates a caption for a <figure> element | |
| 99 | - * @method string figure(string $content, array $attr) | |
| 100 | - * specifies self-contained content | |
| 101 | - * @method string font(string $content, array $attr) | |
| 102 | - * defines font, color, and size for text (not supported in HTML5. use CSS instead) | |
| 103 | - * @method string footer(string $content, array $attr) | |
| 104 | - * creates a footer for a document or section | |
| 105 | - * @method string form(string $content, array $attr) | |
| 106 | - * creates an HTML form for user input | |
| 107 | - * @method string frame(string $content, array $attr) | |
| 108 | - * defines a window (a frame) in a frameset (not supported in HTML5) | |
| 109 | - * @method string frameset(string $content, array $attr) | |
| 110 | - * defines a set of frames (not supported in HTML5) | |
| 111 | - * @method string h1(string $content, array $attr) | |
| 112 | - * creates HTML headings 1 | |
| 113 | - * @method string h2(string $content, array $attr) | |
| 114 | - * creates HTML headings 2 | |
| 115 | - * @method string h3(string $content, array $attr) | |
| 116 | - * creates HTML headings 3 | |
| 117 | - * @method string h4(string $content, array $attr) | |
| 118 | - * creates HTML headings 4 | |
| 119 | - * @method string h5(string $content, array $attr) | |
| 120 | - * creates HTML headings 5 | |
| 121 | - * @method string h6(string $content, array $attr) | |
| 122 | - * creates HTML headings 6 | |
| 123 | - * @method string head(string $content, array $attr) | |
| 124 | - * contains metadata/information for the document | |
| 125 | - * @method string header(string $content, array $attr) | |
| 126 | - * creates a header for a document or section | |
| 127 | - * @method string hr(string $content, array $attr) | |
| 128 | - * creates a thematic change in the content | |
| 129 | - * @method string html(string $content, array $attr) | |
| 130 | - * creates the root of an HTML document | |
| 131 | - * @method string i(string $content, array $attr) | |
| 132 | - * creates a part of text in an alternate voice or mood | |
| 133 | - * @method string iframe(string $content, array $attr) | |
| 134 | - * creates an inline frame | |
| 135 | - * @method string input(string $content, array $attr) | |
| 136 | - * creates an input control | |
| 137 | - * @method string ins(string $content, array $attr) | |
| 138 | - * creates a text that has been inserted into a document | |
| 139 | - * @method string kbd(string $content, array $attr) | |
| 140 | - * creates keyboard input | |
| 141 | - * @method string label(string $content, array $attr) | |
| 142 | - * creates a label for an <input> element | |
| 143 | - * @method string legend(string $content, array $attr) | |
| 144 | - * creates a caption for a <fieldset> element | |
| 145 | - * @method string li(string $content, array $attr) | |
| 146 | - * creates a list item | |
| 147 | - * @method string link(string $content, array $attr) | |
| 148 | - * creates the relationship between a document and an external resource | |
| 149 | - * (most used to link to style sheets) | |
| 150 | - * @method string main(string $content, array $attr) | |
| 151 | - * specifies the main content of a document | |
| 152 | - * @method string map(string $content, array $attr) | |
| 153 | - * creates an image map | |
| 154 | - * @method string mark(string $content, array $attr) | |
| 155 | - * creates marked/highlighted text | |
| 156 | - * @method string meta(string $content, array $attr) | |
| 157 | - * creates metadata about an HTML document | |
| 158 | - * @method string meter(string $content, array $attr) | |
| 159 | - * creates a scalar measurement within a known range (a gauge) | |
| 160 | - * @method string nav(string $content, array $attr) | |
| 161 | - * creates navigation links | |
| 162 | - * @method string noframes(string $content, array $attr) | |
| 163 | - * defines an alternate content for users that do not support frames | |
| 164 | - * (not supported in HTML5) | |
| 165 | - * @method string noscript(string $content, array $attr) | |
| 166 | - * creates an alternate content for users that do not support client-side scripts | |
| 167 | - * @method string object(string $content, array $attr) | |
| 168 | - * creates a container for an external application | |
| 169 | - * @method string ol(string $content, array $attr) | |
| 170 | - * creates an ordered list | |
| 171 | - * @method string optgroup(string $content, array $attr) | |
| 172 | - * creates a group of related options in a drop-down list | |
| 173 | - * @method string option(string $content, array $attr) | |
| 174 | - * creates an option in a drop-down list | |
| 175 | - * @method string output(string $content, array $attr) | |
| 176 | - * creates the result of a calculation | |
| 177 | - * @method string p(string $content, array $attr) | |
| 178 | - * creates a paragraph | |
| 179 | - * @method string param(string $content, array $attr) | |
| 180 | - * creates a parameter for an object | |
| 181 | - * @method string picture(string $content, array $attr) | |
| 182 | - * creates a container for multiple image resources | |
| 183 | - * @method string pre(string $content, array $attr) | |
| 184 | - * creates preformatted text | |
| 185 | - * @method string progress(string $content, array $attr) represents the progress of a task | |
| 186 | - * @method string q(string $content, array $attr) | |
| 187 | - * creates a short quotation | |
| 188 | - * @method string rp(string $content, array $attr) | |
| 189 | - * creates what to show in browsers that do not support ruby annotations | |
| 190 | - * @method string rt(string $content, array $attr) | |
| 191 | - * creates an explanation/pronunciation of characters (for east asian typography) | |
| 192 | - * @method string ruby(string $content, array $attr) | |
| 193 | - * creates a ruby annotation (for east asian typography) | |
| 194 | - * @method string s(string $content, array $attr) | |
| 195 | - * creates text that is no longer correct | |
| 196 | - * @method string samp(string $content, array $attr) | |
| 197 | - * creates sample output from a computer program | |
| 198 | - * @method string script(string $content, array $attr) | |
| 199 | - * creates a client-side script | |
| 200 | - * @method string section(string $content, array $attr) | |
| 201 | - * creates a section in a document | |
| 202 | - * @method string select(string $content, array $attr) | |
| 203 | - * creates a drop-down list | |
| 204 | - * @method string small(string $content, array $attr) | |
| 205 | - * creates smaller text | |
| 206 | - * @method string source(string $content, array $attr) | |
| 207 | - * creates multiple media resources for media elements (<video> and <audio>) | |
| 208 | - * @method string span(string $content, array $attr) | |
| 209 | - * creates a section in a document | |
| 210 | - * @method string strike(string $content, array $attr) defines strikethrough text | |
| 211 | - * (not supported in HTML5. use del() or s() instead) | |
| 212 | - * @method string strong(string $content, array $attr) | |
| 213 | - * creates important text | |
| 214 | - * @method string style(string $content, array $attr) | |
| 215 | - * creates style information for a document | |
| 216 | - * @method string sub(string $content, array $attr) | |
| 217 | - * creates subscripted text | |
| 218 | - * @method string summary(string $content, array $attr) | |
| 219 | - * creates a visible heading for a <details> element | |
| 220 | - * @method string sup(string $content, array $attr) | |
| 221 | - * creates superscripted text | |
| 222 | - * @method string svg(string $content, array $attr) | |
| 223 | - * creates a container for svg graphics | |
| 224 | - * @method string table(string $content, array $attr) | |
| 225 | - * creates a table | |
| 226 | - * @method string tbody(string $content, array $attr) groups the body content in a table | |
| 227 | - * @method string td(string $content, array $attr) | |
| 228 | - * creates a cell in a table | |
| 229 | - * @method string template(string $content, array $attr) | |
| 230 | - * creates a container for content that should be hidden when the page loads | |
| 231 | - * @method string textarea(string $content, array $attr) | |
| 232 | - * creates a multiline input control (text area) | |
| 233 | - * @method string tfoot(string $content, array $attr) groups the footer content in a table | |
| 234 | - * @method string th(string $content, array $attr) | |
| 235 | - * creates a header cell in a table | |
| 236 | - * @method string thead(string $content, array $attr) groups the header content in a table | |
| 237 | - * @method string time(string $content, array $attr) | |
| 238 | - * creates a specific time (or datetime) | |
| 239 | - * @method string title(string $content, array $attr) | |
| 240 | - * creates a title for the document | |
| 241 | - * @method string tr(string $content, array $attr) | |
| 242 | - * creates a row in a table | |
| 243 | - * @method string track(string $content, array $attr) | |
| 244 | - * creates text tracks for media elements (<video> and <audio>) | |
| 245 | - * @method string tt(string $content, array $attr) | |
| 246 | - * creates an element that defines teletype text (not supported in HTML5. use CSS instead) | |
| 247 | - * @method string u(string $content, array $attr) | |
| 248 | - * creates some text that is unarticulated and styled differently from normal text | |
| 249 | - * @method string ul(string $content, array $attr) | |
| 250 | - * creates an unordered list | |
| 251 | - * @method string var(string $content, array $attr) | |
| 252 | - * creates a variable | |
| 253 | - * @method string video(string $content, array $attr) | |
| 254 | - * creates embedded video content | |
| 255 | - * @method string wbr(string $content, array $attr) | |
| 256 | - * creates a possible line-break | |
| 257 | - */ | |
| 14 | + * show off @method | |
| 15 | + * | |
| 16 | + * @method string abbr(string $content, array $attr) | |
| 17 | + * creates an abbreviation or an acronym | |
| 18 | + * @method string acronym(string $content, array $attr) | |
| 19 | + * creates an acronym (not supported in HTML5. use abbr() instead) | |
| 20 | + * @method string address(string $content, array $attr) | |
| 21 | + * creates contact information for the author/owner of a document | |
| 22 | + * @method string applet(string $content, array $attr) | |
| 23 | + * creates an embedded applet | |
| 24 | + * (not supported in HTML5. use embed() or <object> instead) | |
| 25 | + * @method string area(string $content, array $attr) | |
| 26 | + * creates an area inside an image map | |
| 27 | + * @method string article(string $content, array $attr) | |
| 28 | + * creates an article | |
| 29 | + * @method string aside(string $content, array $attr) | |
| 30 | + * creates content aside from the page content | |
| 31 | + * @method string audio(string $content, array $attr) | |
| 32 | + * creates embedded sound content | |
| 33 | + * @method string b(string $content, array $attr) | |
| 34 | + * creates bold text | |
| 35 | + * @method string base(string $content, array $attr) | |
| 36 | + * creates an element that specifies the base url/target for all relative urls in a document | |
| 37 | + * @method string basefont(string $content, array $attr) | |
| 38 | + * creates an element that specifies a default color, size, and font for all text in a document | |
| 39 | + * (not supported in HTML5. use CSS instead) | |
| 40 | + * @method string bdi(string $content, array $attr) | |
| 41 | + * creates an element that isolates a part of text that might be formatted | |
| 42 | + * in a different direction from other text outside it | |
| 43 | + * @method string bdo(string $content, array $attr) | |
| 44 | + * creates an element that overrides the current text direction | |
| 45 | + * @method string big(string $content, array $attr) | |
| 46 | + * creates an element that defines big text (not supported in HTML5. use CSS instead) | |
| 47 | + * @method string blockquote(string $content, array $attr) | |
| 48 | + * creates a section that is quoted from another source | |
| 49 | + * @method string body(string $content, array $attr) | |
| 50 | + * creates the document's body | |
| 51 | + * @method string br(string $content, array $attr) | |
| 52 | + * creates a single line break | |
| 53 | + * @method string button(string $content, array $attr) | |
| 54 | + * creates a clickable button | |
| 55 | + * @method string canvas(string $content, array $attr) | |
| 56 | + * used to draw graphics, on the fly, via scripting (usually javascript) | |
| 57 | + * @method string caption(string $content, array $attr) | |
| 58 | + * creates a table caption | |
| 59 | + * @method string center(string $content, array $attr) | |
| 60 | + * defines centered text (not supported in HTML5. use CSS instead) | |
| 61 | + * @method string cite(string $content, array $attr) | |
| 62 | + * creates the title of a work | |
| 63 | + * @method string code(string $content, array $attr) | |
| 64 | + * creates a piece of computer code | |
| 65 | + * @method string col(string $content, array $attr) | |
| 66 | + * specifies column properties for each column within a <colgroup> element | |
| 67 | + * @method string colgroup(string $content, array $attr) | |
| 68 | + * specifies a group of one or more columns in a table for formatting | |
| 69 | + * @method string data(string $content, array $attr) | |
| 70 | + * adds a machine-readable translation of a given content | |
| 71 | + * @method string datalist(string $content, array $attr) | |
| 72 | + * specifies a list of pre-defined options for input controls | |
| 73 | + * @method string dd(string $content, array $attr) | |
| 74 | + * creates a description/value of a term in a description list | |
| 75 | + * @method string del(string $content, array $attr) | |
| 76 | + * creates text that has been deleted from a document | |
| 77 | + * @method string details(string $content, array $attr) | |
| 78 | + * creates additional details that the user can view or hide | |
| 79 | + * @method string dfn(string $content, array $attr) | |
| 80 | + * specifies a term that is going to be defined within the content | |
| 81 | + * @method string dialog(string $content, array $attr) | |
| 82 | + * creates a dialog box or window | |
| 83 | + * @method string dir(string $content, array $attr) | |
| 84 | + * defines a directory list (not supported in HTML5. use ul() instead) | |
| 85 | + * @method string div(string $content, array $attr) | |
| 86 | + * creates a section in a document | |
| 87 | + * @method string dl(string $content, array $attr) | |
| 88 | + * creates a description list | |
| 89 | + * @method string dt(string $content, array $attr) | |
| 90 | + * creates a term/name in a description list | |
| 91 | + * @method string em(string $content, array $attr) | |
| 92 | + * creates emphasized text | |
| 93 | + * @method string embed(string $content, array $attr) | |
| 94 | + * creates a container for an external application | |
| 95 | + * @method string fieldset(string $content, array $attr) | |
| 96 | + * groups related elements in a form | |
| 97 | + * @method string figcaption(string $content, array $attr) | |
| 98 | + * creates a caption for a <figure> element | |
| 99 | + * @method string figure(string $content, array $attr) | |
| 100 | + * specifies self-contained content | |
| 101 | + * @method string font(string $content, array $attr) | |
| 102 | + * defines font, color, and size for text (not supported in HTML5. use CSS instead) | |
| 103 | + * @method string footer(string $content, array $attr) | |
| 104 | + * creates a footer for a document or section | |
| 105 | + * @method string form(string $content, array $attr) | |
| 106 | + * creates an HTML form for user input | |
| 107 | + * @method string frame(string $content, array $attr) | |
| 108 | + * defines a window (a frame) in a frameset (not supported in HTML5) | |
| 109 | + * @method string frameset(string $content, array $attr) | |
| 110 | + * defines a set of frames (not supported in HTML5) | |
| 111 | + * @method string h1(string $content, array $attr) | |
| 112 | + * creates HTML headings 1 | |
| 113 | + * @method string h2(string $content, array $attr) | |
| 114 | + * creates HTML headings 2 | |
| 115 | + * @method string h3(string $content, array $attr) | |
| 116 | + * creates HTML headings 3 | |
| 117 | + * @method string h4(string $content, array $attr) | |
| 118 | + * creates HTML headings 4 | |
| 119 | + * @method string h5(string $content, array $attr) | |
| 120 | + * creates HTML headings 5 | |
| 121 | + * @method string h6(string $content, array $attr) | |
| 122 | + * creates HTML headings 6 | |
| 123 | + * @method string head(string $content, array $attr) | |
| 124 | + * contains metadata/information for the document | |
| 125 | + * @method string header(string $content, array $attr) | |
| 126 | + * creates a header for a document or section | |
| 127 | + * @method string hr(string $content, array $attr) | |
| 128 | + * creates a thematic change in the content | |
| 129 | + * @method string html(string $content, array $attr) | |
| 130 | + * creates the root of an HTML document | |
| 131 | + * @method string i(string $content, array $attr) | |
| 132 | + * creates a part of text in an alternate voice or mood | |
| 133 | + * @method string iframe(string $content, array $attr) | |
| 134 | + * creates an inline frame | |
| 135 | + * @method string input(string $content, array $attr) | |
| 136 | + * creates an input control | |
| 137 | + * @method string ins(string $content, array $attr) | |
| 138 | + * creates a text that has been inserted into a document | |
| 139 | + * @method string kbd(string $content, array $attr) | |
| 140 | + * creates keyboard input | |
| 141 | + * @method string label(string $content, array $attr) | |
| 142 | + * creates a label for an <input> element | |
| 143 | + * @method string legend(string $content, array $attr) | |
| 144 | + * creates a caption for a <fieldset> element | |
| 145 | + * @method string li(string $content, array $attr) | |
| 146 | + * creates a list item | |
| 147 | + * @method string link(string $content, array $attr) | |
| 148 | + * creates the relationship between a document and an external resource | |
| 149 | + * (most used to link to style sheets) | |
| 150 | + * @method string main(string $content, array $attr) | |
| 151 | + * specifies the main content of a document | |
| 152 | + * @method string map(string $content, array $attr) | |
| 153 | + * creates an image map | |
| 154 | + * @method string mark(string $content, array $attr) | |
| 155 | + * creates marked/highlighted text | |
| 156 | + * @method string meta(string $content, array $attr) | |
| 157 | + * creates metadata about an HTML document | |
| 158 | + * @method string meter(string $content, array $attr) | |
| 159 | + * creates a scalar measurement within a known range (a gauge) | |
| 160 | + * @method string nav(string $content, array $attr) | |
| 161 | + * creates navigation links | |
| 162 | + * @method string noframes(string $content, array $attr) | |
| 163 | + * defines an alternate content for users that do not support frames | |
| 164 | + * (not supported in HTML5) | |
| 165 | + * @method string noscript(string $content, array $attr) | |
| 166 | + * creates an alternate content for users that do not support client-side scripts | |
| 167 | + * @method string object(string $content, array $attr) | |
| 168 | + * creates a container for an external application | |
| 169 | + * @method string ol(string $content, array $attr) | |
| 170 | + * creates an ordered list | |
| 171 | + * @method string optgroup(string $content, array $attr) | |
| 172 | + * creates a group of related options in a drop-down list | |
| 173 | + * @method string option(string $content, array $attr) | |
| 174 | + * creates an option in a drop-down list | |
| 175 | + * @method string output(string $content, array $attr) | |
| 176 | + * creates the result of a calculation | |
| 177 | + * @method string p(string $content, array $attr) | |
| 178 | + * creates a paragraph | |
| 179 | + * @method string param(string $content, array $attr) | |
| 180 | + * creates a parameter for an object | |
| 181 | + * @method string picture(string $content, array $attr) | |
| 182 | + * creates a container for multiple image resources | |
| 183 | + * @method string pre(string $content, array $attr) | |
| 184 | + * creates preformatted text | |
| 185 | + * @method string progress(string $content, array $attr) represents the progress of a task | |
| 186 | + * @method string q(string $content, array $attr) | |
| 187 | + * creates a short quotation | |
| 188 | + * @method string rp(string $content, array $attr) | |
| 189 | + * creates what to show in browsers that do not support ruby annotations | |
| 190 | + * @method string rt(string $content, array $attr) | |
| 191 | + * creates an explanation/pronunciation of characters (for east asian typography) | |
| 192 | + * @method string ruby(string $content, array $attr) | |
| 193 | + * creates a ruby annotation (for east asian typography) | |
| 194 | + * @method string s(string $content, array $attr) | |
| 195 | + * creates text that is no longer correct | |
| 196 | + * @method string samp(string $content, array $attr) | |
| 197 | + * creates sample output from a computer program | |
| 198 | + * @method string script(string $content, array $attr) | |
| 199 | + * creates a client-side script | |
| 200 | + * @method string section(string $content, array $attr) | |
| 201 | + * creates a section in a document | |
| 202 | + * @method string select(string $content, array $attr) | |
| 203 | + * creates a drop-down list | |
| 204 | + * @method string small(string $content, array $attr) | |
| 205 | + * creates smaller text | |
| 206 | + * @method string source(string $content, array $attr) | |
| 207 | + * creates multiple media resources for media elements (<video> and <audio>) | |
| 208 | + * @method string span(string $content, array $attr) | |
| 209 | + * creates a section in a document | |
| 210 | + * @method string strike(string $content, array $attr) defines strikethrough text | |
| 211 | + * (not supported in HTML5. use del() or s() instead) | |
| 212 | + * @method string strong(string $content, array $attr) | |
| 213 | + * creates important text | |
| 214 | + * @method string style(string $content, array $attr) | |
| 215 | + * creates style information for a document | |
| 216 | + * @method string sub(string $content, array $attr) | |
| 217 | + * creates subscripted text | |
| 218 | + * @method string summary(string $content, array $attr) | |
| 219 | + * creates a visible heading for a <details> element | |
| 220 | + * @method string sup(string $content, array $attr) | |
| 221 | + * creates superscripted text | |
| 222 | + * @method string svg(string $content, array $attr) | |
| 223 | + * creates a container for svg graphics | |
| 224 | + * @method string table(string $content, array $attr) | |
| 225 | + * creates a table | |
| 226 | + * @method string tbody(string $content, array $attr) groups the body content in a table | |
| 227 | + * @method string td(string $content, array $attr) | |
| 228 | + * creates a cell in a table | |
| 229 | + * @method string template(string $content, array $attr) | |
| 230 | + * creates a container for content that should be hidden when the page loads | |
| 231 | + * @method string textarea(string $content, array $attr) | |
| 232 | + * creates a multiline input control (text area) | |
| 233 | + * @method string tfoot(string $content, array $attr) groups the footer content in a table | |
| 234 | + * @method string th(string $content, array $attr) | |
| 235 | + * creates a header cell in a table | |
| 236 | + * @method string thead(string $content, array $attr) groups the header content in a table | |
| 237 | + * @method string time(string $content, array $attr) | |
| 238 | + * creates a specific time (or datetime) | |
| 239 | + * @method string title(string $content, array $attr) | |
| 240 | + * creates a title for the document | |
| 241 | + * @method string tr(string $content, array $attr) | |
| 242 | + * creates a row in a table | |
| 243 | + * @method string track(string $content, array $attr) | |
| 244 | + * creates text tracks for media elements (<video> and <audio>) | |
| 245 | + * @method string tt(string $content, array $attr) | |
| 246 | + * creates an element that defines teletype text (not supported in HTML5. use CSS instead) | |
| 247 | + * @method string u(string $content, array $attr) | |
| 248 | + * creates some text that is unarticulated and styled differently from normal text | |
| 249 | + * @method string ul(string $content, array $attr) | |
| 250 | + * creates an unordered list | |
| 251 | + * @method string var(string $content, array $attr) | |
| 252 | + * creates a variable | |
| 253 | + * @method string video(string $content, array $attr) | |
| 254 | + * creates embedded video content | |
| 255 | + * @method string wbr(string $content, array $attr) | |
| 256 | + * creates a possible line-break | |
| 257 | + */ | |
| 258 | 258 | |
| 259 | 259 | declare(strict_types=1); | 
| 260 | 260 | |
| @@ -48,7 +48,7 @@ discard block | ||
| 48 | 48 |          foreach ($this->tags as $tag) { | 
| 49 | 49 | $e = new Element($tag); | 
| 50 | 50 |              if ($e->isVoid()) { | 
| 51 | -                $this->assertEquals('<' . $tag . '/>', $e->__toString()); | |
| 51 | +                $this->assertEquals('<'.$tag.'/>', $e->__toString()); | |
| 52 | 52 |              } else { | 
| 53 | 53 |                  $this->assertEquals(sprintf('<%s></%s>', $tag, $tag), $e->__toString()); | 
| 54 | 54 | } | 
| @@ -68,7 +68,7 @@ discard block | ||
| 68 | 68 | $e = new Element($tag, $message); | 
| 69 | 69 | |
| 70 | 70 |                  if ($e->isVoid()) { | 
| 71 | -                    $this->assertEquals('<' . $tag . '/>', $e->__toString()); | |
| 71 | +                    $this->assertEquals('<'.$tag.'/>', $e->__toString()); | |
| 72 | 72 |                  } else { | 
| 73 | 73 |                      $this->assertEquals(sprintf('<%s>%s</%s>', $tag, $expected, $tag), $e->__toString()); | 
| 74 | 74 | } | 
| @@ -117,7 +117,7 @@ discard block | ||
| 117 | 117 | $this->assertForAllHTMLTags($message, $attributes, $attributes_expected_string); | 
| 118 | 118 | |
| 119 | 119 | |
| 120 | - $attributes = ['class' => 'test_class', 'style="color:red;"','id' => 'test_id']; | |
| 120 | + $attributes = ['class' => 'test_class', 'style="color:red;"', 'id' => 'test_id']; | |
| 121 | 121 | $attributes_expected_string = ' class="test_class" style="color:red;" id="test_id"'; | 
| 122 | 122 | |
| 123 | 123 | // testing attributes string generator | 
| @@ -315,7 +315,7 @@ | ||
| 315 | 315 | return | 
| 316 | 316 | Marker::div( | 
| 317 | 317 | Marker::label( | 
| 318 | - Form::input($name, $value, $attributes) . Marker::span($label), | |
| 318 | + Form::input($name, $value, $attributes).Marker::span($label), | |
| 319 | 319 | ['for' => $attributes['id']] | 
| 320 | 320 | ), | 
| 321 | 321 | ['class' => 'checkbutton'] | 
| @@ -1,9 +1,9 @@ discard block | ||
| 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 | |
| @@ -13,11 +13,11 @@ discard block | ||
| 13 | 13 |  { | 
| 14 | 14 | |
| 15 | 15 | /** | 
| 16 | - * ? makes more sense to write | |
| 17 | -      * Marker::img('path/to/img.jpg', 'An alternative text', ['width' => 34, 'height' => 34]) | |
| 18 | - * than | |
| 19 | - * Marker::img(null, ['src' => 'path/to/img.jpg', 'alt' => 'An alternative text', 'width' => 34, 'height' => 34]) | |
| 20 | - */ | |
| 16 | + * ? makes more sense to write | |
| 17 | +     * Marker::img('path/to/img.jpg', 'An alternative text', ['width' => 34, 'height' => 34]) | |
| 18 | + * than | |
| 19 | + * Marker::img(null, ['src' => 'path/to/img.jpg', 'alt' => 'An alternative text', 'width' => 34, 'height' => 34]) | |
| 20 | + */ | |
| 21 | 21 | public static function img(string $src, string $alt, array $attributes = []): Element | 
| 22 | 22 |      { | 
| 23 | 23 | $attributes['src'] ??= $src; | 
| @@ -28,11 +28,11 @@ discard block | ||
| 28 | 28 | } | 
| 29 | 29 | |
| 30 | 30 | /** | 
| 31 | - * ? makes more sense to write | |
| 32 | -      * Marker::a('controller/task/id', 'Click here', ['class' => 'nav']) | |
| 33 | - * than | |
| 34 | -      * Marker::a('Click here', ['href' => controller/task/id', 'class' => 'nav']) | |
| 35 | - */ | |
| 31 | + * ? makes more sense to write | |
| 32 | +     * Marker::a('controller/task/id', 'Click here', ['class' => 'nav']) | |
| 33 | + * than | |
| 34 | +     * Marker::a('Click here', ['href' => controller/task/id', 'class' => 'nav']) | |
| 35 | + */ | |
| 36 | 36 | public static function a(string $href, string $label, array $attributes = []): Element | 
| 37 | 37 |      { | 
| 38 | 38 | $attributes['href'] ??= $href; | 
| @@ -108,7 +108,7 @@ discard block | ||
| 108 | 108 |          foreach ($list as $value => $label) { | 
| 109 | 109 | $option_attributes = ['value' => $value]; | 
| 110 | 110 |              if ($selected == $value) { | 
| 111 | - $option_attributes['selected'] = 'selected'; | |
| 111 | + $option_attributes['selected'] = 'selected'; | |
| 112 | 112 | } | 
| 113 | 113 | |
| 114 | 114 |              $options .= new Element('option', "$label", $option_attributes); | 
| @@ -126,7 +126,7 @@ discard block | ||
| 126 | 126 | */ | 
| 127 | 127 | public static function legend(string $label, array $attributes = []): string | 
| 128 | 128 |      { | 
| 129 | -        return '' . (new Element('legend', $label, $attributes)); | |
| 129 | +        return ''.(new Element('legend', $label, $attributes)); | |
| 130 | 130 | } | 
| 131 | 131 | |
| 132 | 132 | /** | 
| @@ -196,6 +196,6 @@ discard block | ||
| 196 | 196 | unset($attributes['label']); | 
| 197 | 197 | } | 
| 198 | 198 | |
| 199 | - return $label . (new Element($tag, $content, $attributes)); | |
| 199 | + return $label.(new Element($tag, $content, $attributes)); | |
| 200 | 200 | } | 
| 201 | 201 | } |