Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like Html often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use Html, and based on these observations, apply Extract Interface, too.
1 | <?php /** MicroHtml */ |
||
17 | class Html |
||
18 | { |
||
19 | // BASIC Elements |
||
20 | |||
21 | /** |
||
22 | * Render meta tag |
||
23 | * |
||
24 | * @access public |
||
25 | * |
||
26 | * @param string $name name of element |
||
27 | * @param string $content content of element |
||
28 | * @param array $attributes attributes tag |
||
29 | * |
||
30 | * @return string |
||
31 | * @static |
||
32 | */ |
||
33 | public static function meta($name, $content, array $attributes = []) |
||
40 | |||
41 | /** |
||
42 | * Render tag |
||
43 | * |
||
44 | * @access public |
||
45 | * |
||
46 | * @param string $name tag name |
||
47 | * @param array $attributes tag attributes |
||
48 | * |
||
49 | * @return string |
||
50 | * @static |
||
51 | */ |
||
52 | View Code Duplication | public static function tag($name, array $attributes = []) |
|
61 | |||
62 | /** |
||
63 | * Render link tag |
||
64 | * |
||
65 | * @access public |
||
66 | * |
||
67 | * @param string $name name of element |
||
68 | * @param string $url url path |
||
69 | * @param array $attributes attributes tag |
||
70 | * |
||
71 | * @return string |
||
72 | * @static |
||
73 | */ |
||
74 | public static function link($name, $url, array $attributes = []) |
||
80 | |||
81 | // HEAD Elements |
||
82 | |||
83 | /** |
||
84 | * Render open tag |
||
85 | * |
||
86 | * @access public |
||
87 | * |
||
88 | * @param string $name tag name |
||
89 | * @param array $attributes tag attributes |
||
90 | * |
||
91 | * @return string |
||
92 | * @static |
||
93 | */ |
||
94 | View Code Duplication | public static function openTag($name, array $attributes = []) |
|
103 | |||
104 | /** |
||
105 | * Render close tag |
||
106 | * |
||
107 | * @access public |
||
108 | * |
||
109 | * @param string $name tag name |
||
110 | * |
||
111 | * @return string |
||
112 | * @static |
||
113 | */ |
||
114 | public static function closeTag($name) |
||
118 | |||
119 | /** |
||
120 | * Render favicon file |
||
121 | * |
||
122 | * @access public |
||
123 | * |
||
124 | * @param string $url path to favicon |
||
125 | * |
||
126 | * @return string |
||
127 | * @static |
||
128 | */ |
||
129 | public static function favicon($url) |
||
133 | |||
134 | /** |
||
135 | * Render css file |
||
136 | * |
||
137 | * @access public |
||
138 | * |
||
139 | * @param string $file path to css |
||
140 | * |
||
141 | * @return string |
||
142 | * @static |
||
143 | */ |
||
144 | public static function cssFile($file) |
||
148 | |||
149 | /** |
||
150 | * Render script file |
||
151 | * |
||
152 | * @access public |
||
153 | * |
||
154 | * @param string $file path to script |
||
155 | * |
||
156 | * @return string |
||
157 | * @static |
||
158 | */ |
||
159 | public static function scriptFile($file) |
||
163 | |||
164 | /** |
||
165 | * Render style source |
||
166 | * |
||
167 | * @access public |
||
168 | * |
||
169 | * @param string $text style |
||
170 | * @param array $attributes attributes tag |
||
171 | * |
||
172 | * @return string |
||
173 | * @static |
||
174 | */ |
||
175 | public static function css($text, array $attributes = []) |
||
181 | |||
182 | /** |
||
183 | * Render script source |
||
184 | * |
||
185 | * @access public |
||
186 | * |
||
187 | * @param string $text script |
||
188 | * @param array $attributes attributes tag |
||
189 | * |
||
190 | * @return string |
||
191 | * @static |
||
192 | */ |
||
193 | public static function script($text, array $attributes = []) |
||
200 | |||
201 | /** |
||
202 | * Render docType tag |
||
203 | * |
||
204 | * @access public |
||
205 | * |
||
206 | * @param string $name doctype name |
||
207 | * |
||
208 | * @return string|boolean |
||
209 | * @static |
||
210 | */ |
||
211 | public static function doctype($name) |
||
230 | |||
231 | /** |
||
232 | * Render title tag |
||
233 | * |
||
234 | * @access public |
||
235 | * |
||
236 | * @param string $name title name |
||
237 | * |
||
238 | * @return string |
||
239 | * @static |
||
240 | */ |
||
241 | public static function title($name) |
||
245 | |||
246 | /** |
||
247 | * Render BR tag |
||
248 | * |
||
249 | * @access public |
||
250 | * |
||
251 | * @param integer $num number of render BR's |
||
252 | * @param array $attributes attributes tag |
||
253 | * |
||
254 | * @return string |
||
255 | * @static |
||
256 | */ |
||
257 | public static function br($num = 1, array $attributes = []) |
||
266 | |||
267 | // BODY Elements |
||
268 | |||
269 | /** |
||
270 | * Render mail a tag |
||
271 | * |
||
272 | * @access public |
||
273 | * |
||
274 | * @param string $name name of e-mail |
||
275 | * @param string $email e-mail path |
||
276 | * @param array $attributes attributes tag |
||
277 | * |
||
278 | * @return string |
||
279 | * @static |
||
280 | */ |
||
281 | public static function mailto($name, $email, array $attributes = []) |
||
287 | |||
288 | /** |
||
289 | * Render anchor |
||
290 | * |
||
291 | * @access public |
||
292 | * |
||
293 | * @param string $name name to link |
||
294 | * @param string $url path to link |
||
295 | * @param array $attributes attributes tag |
||
296 | * |
||
297 | * @return string |
||
298 | * @static |
||
299 | */ |
||
300 | public static function href($name, $url, array $attributes = []) |
||
306 | |||
307 | /** |
||
308 | * Render H{1-N} tag |
||
309 | * |
||
310 | * @access public |
||
311 | * |
||
312 | * @param string $num H number |
||
313 | * @param string $value H value |
||
314 | * @param array $attributes attributes tag |
||
315 | * |
||
316 | * @return string |
||
317 | * @static |
||
318 | */ |
||
319 | public static function heading($num, $value = null, array $attributes = []) |
||
323 | |||
324 | /** |
||
325 | * Render image map tag |
||
326 | * |
||
327 | * @access public |
||
328 | * |
||
329 | * @param string $alt Alternative text |
||
330 | * @param string $source Path to image |
||
331 | * @param string $name Map name |
||
332 | * @param array $attributeImg Attributes for image |
||
333 | * @param array $coordinates Coordinates for image |
||
334 | * |
||
335 | * @return string |
||
336 | * @static |
||
337 | */ |
||
338 | public static function imgmap($alt, $source, $name, array $attributeImg = [], array $coordinates = []) |
||
351 | |||
352 | /** |
||
353 | * Render image file |
||
354 | * |
||
355 | * @access public |
||
356 | * |
||
357 | * @param string $name name of image |
||
358 | * @param string $file path image file |
||
359 | * @param array $attributes attributes tag |
||
360 | * |
||
361 | * @return string |
||
362 | * @static |
||
363 | */ |
||
364 | public static function image($name, $file, array $attributes = []) |
||
371 | |||
372 | /** |
||
373 | * Render object tag |
||
374 | * |
||
375 | * @access public |
||
376 | * |
||
377 | * @param string $source Path to content |
||
378 | * @param array $attributes Attributes for object |
||
379 | * @param array $params Parameters for object |
||
380 | * |
||
381 | * @return string |
||
382 | * @static |
||
383 | */ |
||
384 | public static function object($source, array $attributes = [], array $params = []) |
||
395 | |||
396 | /** |
||
397 | * Embedding objects (video, audio, flash, etc.) |
||
398 | * |
||
399 | * @access public |
||
400 | * |
||
401 | * @param string $source Path to content |
||
402 | * @param array $attributes Attributes for embedding |
||
403 | * |
||
404 | * @return string |
||
405 | */ |
||
406 | public static function embed($source, array $attributes = []) |
||
412 | |||
413 | /** |
||
414 | * List elements generator |
||
415 | * |
||
416 | * @access public |
||
417 | * |
||
418 | * @param array $items lists multiple array |
||
419 | * @param array $attributes attributes tag |
||
420 | * @param bool $isNumeric Is a numeric list? |
||
421 | * |
||
422 | * @return string |
||
423 | * @static |
||
424 | */ |
||
425 | public static function lists(array $items = [], array $attributes = [], $isNumeric = false) |
||
447 | |||
448 | // LIST Elements |
||
449 | |||
450 | /** |
||
451 | * Render table element |
||
452 | * |
||
453 | * How to use $elements: |
||
454 | * array( |
||
455 | * array( // row |
||
456 | * 'cells'=>array( // cell |
||
457 | * 'value'=>'text', |
||
458 | * 'attributes'=>[] |
||
459 | * ), |
||
460 | * attributes'=>[] |
||
461 | * ) |
||
462 | * ) |
||
463 | * |
||
464 | * @access public |
||
465 | * |
||
466 | * @param array $elements table elements |
||
467 | * @param array $attributes attributes tag |
||
468 | * |
||
469 | * @return string |
||
470 | * @static |
||
471 | */ |
||
472 | public static function table(array $elements = [], array $attributes = []) |
||
485 | |||
486 | // TABLE Elements |
||
487 | |||
488 | /** |
||
489 | * Render table row element |
||
490 | * |
||
491 | * @access public |
||
492 | * |
||
493 | * @param array $elements array(value, attributes) |
||
494 | * @param boolean $isHeading row is heading? |
||
495 | * @param array $attributes attributes tag |
||
496 | * |
||
497 | * @return string |
||
498 | * @static |
||
499 | */ |
||
500 | public static function tableRow(array $elements = [], $isHeading = false, array $attributes = []) |
||
519 | |||
520 | /** |
||
521 | * Render table cell element |
||
522 | * |
||
523 | * @access public |
||
524 | * |
||
525 | * @param string $text table cell text |
||
526 | * @param array $attributes attributes tag |
||
527 | * |
||
528 | * @return string |
||
529 | * @static |
||
530 | */ |
||
531 | public static function tableCell($text, array $attributes = []) |
||
535 | |||
536 | /** |
||
537 | * Render table heading tag |
||
538 | * |
||
539 | * @access public |
||
540 | * |
||
541 | * @param string $text table heading text |
||
542 | * @param array $attributes attributes tag |
||
543 | * |
||
544 | * @return string |
||
545 | * @static |
||
546 | */ |
||
547 | public static function tableHeading($text, array $attributes = []) |
||
551 | |||
552 | /** |
||
553 | * Render begin table element |
||
554 | * |
||
555 | * @access public |
||
556 | * |
||
557 | * @param array $attributes attributes tag |
||
558 | * |
||
559 | * @return string |
||
560 | * @static |
||
561 | */ |
||
562 | public static function beginTable(array $attributes = []) |
||
566 | |||
567 | /** |
||
568 | * Render end table element |
||
569 | * |
||
570 | * @access public |
||
571 | * @return string |
||
572 | * @static |
||
573 | */ |
||
574 | public static function endTable() |
||
578 | |||
579 | /** |
||
580 | * Render table caption element |
||
581 | * |
||
582 | * @access public |
||
583 | * |
||
584 | * @param string $text table caption text |
||
585 | * @param array $attributes attributes tag |
||
586 | * |
||
587 | * @return string |
||
588 | * @static |
||
589 | */ |
||
590 | public static function tableCaption($text, array $attributes = []) |
||
594 | |||
595 | /** |
||
596 | * Render begin form tag |
||
597 | * |
||
598 | * @access public |
||
599 | * |
||
600 | * @param string $action path to URL action |
||
601 | * @param string $method method of request |
||
602 | * @param array $attributes attributes tag |
||
603 | * |
||
604 | * @return string |
||
605 | * @static |
||
606 | */ |
||
607 | View Code Duplication | public static function beginForm($action, $method = 'POST', array $attributes = []) |
|
614 | |||
615 | // FORM Elements |
||
616 | |||
617 | /** |
||
618 | * Render end form tag |
||
619 | * |
||
620 | * @access public |
||
621 | * @return string |
||
622 | * @static |
||
623 | */ |
||
624 | public static function endForm() |
||
628 | |||
629 | /** |
||
630 | * Render image button tag |
||
631 | * |
||
632 | * @access public |
||
633 | * |
||
634 | * @param string $name image name |
||
635 | * @param string $file image file path |
||
636 | * @param array $attributesButton attributes for button |
||
637 | * @param array $attributesImage attributes for image |
||
638 | * |
||
639 | * @return string |
||
640 | * @static |
||
641 | */ |
||
642 | public static function imageButton($name, $file, array $attributesButton = [], array $attributesImage = []) |
||
646 | |||
647 | /** |
||
648 | * Render button tag |
||
649 | * |
||
650 | * @access public |
||
651 | * |
||
652 | * @param string $text text for button |
||
653 | * @param array $attributes attributes tag |
||
654 | * |
||
655 | * @return string |
||
656 | * @static |
||
657 | */ |
||
658 | public static function button($text, array $attributes = []) |
||
662 | |||
663 | /** |
||
664 | * Render textArea tag |
||
665 | * |
||
666 | * @access public |
||
667 | * |
||
668 | * @param string $name textArea name |
||
669 | * @param string $text textArea text |
||
670 | * @param array $attributes attributes tag |
||
671 | * |
||
672 | * @return string |
||
673 | * @static |
||
674 | */ |
||
675 | View Code Duplication | public static function textArea($name, $text, array $attributes = []) |
|
682 | |||
683 | /** |
||
684 | * Render legend tag |
||
685 | * |
||
686 | * @access public |
||
687 | * |
||
688 | * @param string $text legend text |
||
689 | * @param array $attributes attributes tag |
||
690 | * |
||
691 | * @return string |
||
692 | * @static |
||
693 | */ |
||
694 | public static function legend($text, array $attributes = []) |
||
698 | |||
699 | /** |
||
700 | * Render label tag |
||
701 | * |
||
702 | * @access public |
||
703 | * |
||
704 | * @param string $name label name |
||
705 | * @param string $elemId element ID |
||
706 | * @param array $attributes attributes tag |
||
707 | * |
||
708 | * @return string |
||
709 | * @static |
||
710 | */ |
||
711 | public static function label($name, $elemId = '', array $attributes = []) |
||
717 | |||
718 | /** |
||
719 | * Render dropDownList (select tag) |
||
720 | * |
||
721 | * @access public |
||
722 | * |
||
723 | * @param string $name dropDown name |
||
724 | * @param array $options format array(value, text, attributes) OR array(label, options, attributes) |
||
725 | * @param array $attributes attributes tag |
||
726 | * |
||
727 | * @return string |
||
728 | * @static |
||
729 | */ |
||
730 | public static function dropDownList($name, array $options = [], array $attributes = []) |
||
737 | |||
738 | /** |
||
739 | * Render listBox (select tag) |
||
740 | * |
||
741 | * @access public |
||
742 | * |
||
743 | * @param string $name listBox name |
||
744 | * @param array $options format array(value, text, attributes) OR array(label, options, attributes) |
||
745 | * @param array $attributes attributes tag |
||
746 | * |
||
747 | * @return string |
||
748 | * @static |
||
749 | */ |
||
750 | public static function listBox($name, array $options = [], array $attributes = []) |
||
789 | |||
790 | /** |
||
791 | * Render optGroup tag |
||
792 | * |
||
793 | * @access public |
||
794 | * |
||
795 | * @param string $label label for options group |
||
796 | * @param array $options format array(value, text, attributes) OR array(label, options, attributes) |
||
797 | * @param array $attributes attributes tag |
||
798 | * |
||
799 | * @return string |
||
800 | * @static |
||
801 | */ |
||
802 | public static function optGroup($label, array $options = [], array $attributes = []) |
||
816 | |||
817 | /** |
||
818 | * Render option tag |
||
819 | * |
||
820 | * @access public |
||
821 | * |
||
822 | * @param string $value option value |
||
823 | * @param string $text label for option |
||
824 | * @param array $attributes attributes tag |
||
825 | * |
||
826 | * @return string |
||
827 | * @static |
||
828 | */ |
||
829 | public static function option($value, $text, array $attributes = []) |
||
835 | |||
836 | /** |
||
837 | * Converting array to options |
||
838 | * |
||
839 | * @param array $arr Input array |
||
840 | * |
||
841 | * @return array|null Output array |
||
842 | */ |
||
843 | public static function arrayToOptions(array $arr = []) |
||
852 | |||
853 | /** |
||
854 | * Render checkBoxList (input checkbox tags) |
||
855 | * |
||
856 | * @access public |
||
857 | * |
||
858 | * @param string $name name for checkBox'es in list |
||
859 | * @param array $checkboxes format array(text, value, attributes) |
||
860 | * @param string $format %check% - checkbox , %text% - text |
||
861 | * @param string $selected name selected element |
||
862 | * |
||
863 | * @return string |
||
864 | * @static |
||
865 | */ |
||
866 | public static function checkBoxList( |
||
883 | |||
884 | /** |
||
885 | * Render input checkbox tag |
||
886 | * |
||
887 | * @access public |
||
888 | * |
||
889 | * @param string $name checkBox name |
||
890 | * @param string $value checkBox value |
||
891 | * @param array $attributes attributes tag |
||
892 | * |
||
893 | * @return string |
||
894 | * @static |
||
895 | */ |
||
896 | public static function checkBoxField($name, $value = null, array $attributes = []) |
||
900 | |||
901 | /** |
||
902 | * Base field tag |
||
903 | * |
||
904 | * @access private |
||
905 | * |
||
906 | * @param string $type type of element |
||
907 | * @param string $name name of element |
||
908 | * @param string $value value of element |
||
909 | * @param array $attributes attributes tag |
||
910 | * |
||
911 | * @return string |
||
912 | * @static |
||
913 | */ |
||
914 | private static function field($type, $name, $value = null, array $attributes = []) |
||
923 | |||
924 | // INPUT Elements |
||
925 | |||
926 | /** |
||
927 | * Render radio button list tag |
||
928 | * |
||
929 | * @access public |
||
930 | * |
||
931 | * @param string $name radio name |
||
932 | * @param array $radios format array(text, value, attributes) |
||
933 | * @param string $format %radio% - radio , %text% - text |
||
934 | * @param string $selected name selected element |
||
935 | * |
||
936 | * @return string |
||
937 | * @static |
||
938 | */ |
||
939 | public static function radioButtonList($name, array $radios = [], $format = '<p>%radio% %text%</p>', $selected = '') |
||
953 | |||
954 | /** |
||
955 | * Render input radio tag |
||
956 | * |
||
957 | * @access public |
||
958 | * |
||
959 | * @param string $name radio name |
||
960 | * @param string $value radio value |
||
961 | * @param array $attributes attributes tag |
||
962 | * |
||
963 | * @return string |
||
964 | * @static |
||
965 | */ |
||
966 | public static function radioField($name, $value = null, array $attributes = []) |
||
970 | |||
971 | /** |
||
972 | * Render reset button tag |
||
973 | * |
||
974 | * @access public |
||
975 | * |
||
976 | * @param string $label text for label on button |
||
977 | * @param array $attributes attributes tag |
||
978 | * |
||
979 | * @return string |
||
980 | * @static |
||
981 | */ |
||
982 | View Code Duplication | public static function resetButton($label = 'Reset', array $attributes = []) |
|
989 | |||
990 | /** |
||
991 | * Render submit button tag |
||
992 | * |
||
993 | * @access public |
||
994 | * |
||
995 | * @param string $label text for label on button |
||
996 | * @param array $attributes attributes tag |
||
997 | * |
||
998 | * @return string |
||
999 | * @static |
||
1000 | */ |
||
1001 | View Code Duplication | public static function submitButton($label = 'Submit', array $attributes = []) |
|
1008 | |||
1009 | /** |
||
1010 | * Render input button tag |
||
1011 | * |
||
1012 | * @access public |
||
1013 | * |
||
1014 | * @param string $name button name |
||
1015 | * @param string $value button value |
||
1016 | * @param array $attributes attributes tag |
||
1017 | * |
||
1018 | * @return string |
||
1019 | * @static |
||
1020 | */ |
||
1021 | public static function buttonField($name, $value = null, array $attributes = []) |
||
1025 | |||
1026 | /** |
||
1027 | * Render input file tag |
||
1028 | * |
||
1029 | * @access public |
||
1030 | * |
||
1031 | * @param string $name file name |
||
1032 | * @param string $value file value |
||
1033 | * @param array $attributes attributes tag |
||
1034 | * |
||
1035 | * @return string |
||
1036 | * @static |
||
1037 | */ |
||
1038 | public static function fileField($name, $value = null, array $attributes = []) |
||
1042 | |||
1043 | /** |
||
1044 | * Render input hidden tag |
||
1045 | * |
||
1046 | * @access public |
||
1047 | * |
||
1048 | * @param string $name hidden name |
||
1049 | * @param string $value hidden value |
||
1050 | * @param array $attributes attributes tag |
||
1051 | * |
||
1052 | * @return string |
||
1053 | * @static |
||
1054 | */ |
||
1055 | public static function hiddenField($name, $value = null, array $attributes = []) |
||
1059 | |||
1060 | /** |
||
1061 | * Render input image tag |
||
1062 | * |
||
1063 | * @access public |
||
1064 | * |
||
1065 | * @param string $name image name |
||
1066 | * @param string $value image value |
||
1067 | * @param string $srcFile path to image |
||
1068 | * @param array $attributes attributes tag |
||
1069 | * |
||
1070 | * @return string |
||
1071 | * @static |
||
1072 | */ |
||
1073 | public static function imageField($name, $value = null, $srcFile, array $attributes = []) |
||
1079 | |||
1080 | /** |
||
1081 | * Render input password tag |
||
1082 | * |
||
1083 | * @access public |
||
1084 | * |
||
1085 | * @param string $name password name |
||
1086 | * @param string $value password value |
||
1087 | * @param array $attributes attributes tag |
||
1088 | * |
||
1089 | * @return string |
||
1090 | * @static |
||
1091 | */ |
||
1092 | public static function passwordField($name, $value = null, array $attributes = []) |
||
1096 | |||
1097 | /** |
||
1098 | * Render input text tag |
||
1099 | * |
||
1100 | * @access public |
||
1101 | * |
||
1102 | * @param string $name text name |
||
1103 | * @param string $value text value |
||
1104 | * @param array $attributes attributes tag |
||
1105 | * |
||
1106 | * @return string |
||
1107 | * @static |
||
1108 | */ |
||
1109 | public static function textField($name, $value = null, array $attributes = []) |
||
1113 | |||
1114 | /** |
||
1115 | * Render input color tag |
||
1116 | * |
||
1117 | * @access public |
||
1118 | * |
||
1119 | * @param string $name color name |
||
1120 | * @param string $value color value |
||
1121 | * @param array $attributes attributes tag |
||
1122 | * |
||
1123 | * @return string |
||
1124 | * @static |
||
1125 | */ |
||
1126 | public static function colorField($name, $value = null, array $attributes = []) |
||
1130 | |||
1131 | /** |
||
1132 | * Render input date tag |
||
1133 | * |
||
1134 | * @access public |
||
1135 | * |
||
1136 | * @param string $name date name |
||
1137 | * @param string $value date value |
||
1138 | * @param array $attributes attributes tag |
||
1139 | * |
||
1140 | * @return string |
||
1141 | * @static |
||
1142 | */ |
||
1143 | public static function dateField($name, $value = null, array $attributes = []) |
||
1147 | |||
1148 | /** |
||
1149 | * Render input datetime tag |
||
1150 | * |
||
1151 | * @access public |
||
1152 | * |
||
1153 | * @param string $name datetime name |
||
1154 | * @param string $value datetime value |
||
1155 | * @param array $attributes attributes tag |
||
1156 | * |
||
1157 | * @return string |
||
1158 | * @static |
||
1159 | */ |
||
1160 | public static function datetimeField($name, $value = null, array $attributes = []) |
||
1164 | |||
1165 | /** |
||
1166 | * Render input datetime-local tag |
||
1167 | * |
||
1168 | * @access public |
||
1169 | * |
||
1170 | * @param string $name datetime-local name |
||
1171 | * @param string $value datetime-local value |
||
1172 | * @param array $attributes attributes tag |
||
1173 | * |
||
1174 | * @return string |
||
1175 | * @static |
||
1176 | */ |
||
1177 | public static function datetimeLocalField($name, $value = null, array $attributes = []) |
||
1181 | |||
1182 | /** |
||
1183 | * Render input email tag |
||
1184 | * |
||
1185 | * @access public |
||
1186 | * |
||
1187 | * @param string $name email name |
||
1188 | * @param string $value email value |
||
1189 | * @param array $attributes attributes tag |
||
1190 | * |
||
1191 | * @return string |
||
1192 | * @static |
||
1193 | */ |
||
1194 | public static function emailField($name, $value = null, array $attributes = []) |
||
1198 | |||
1199 | /** |
||
1200 | * Render input number tag |
||
1201 | * |
||
1202 | * @access public |
||
1203 | * |
||
1204 | * @param string $name number name |
||
1205 | * @param string $value number value |
||
1206 | * @param array $attributes attributes tag |
||
1207 | * |
||
1208 | * @return string |
||
1209 | * @static |
||
1210 | */ |
||
1211 | public static function numberField($name, $value = null, array $attributes = []) |
||
1215 | |||
1216 | /** |
||
1217 | * Render input range tag |
||
1218 | * |
||
1219 | * @access public |
||
1220 | * |
||
1221 | * @param string $name range name |
||
1222 | * @param string $value range value |
||
1223 | * @param array $attributes attributes tag |
||
1224 | * |
||
1225 | * @return string |
||
1226 | * @static |
||
1227 | */ |
||
1228 | public static function rangeField($name, $value = null, array $attributes = []) |
||
1232 | |||
1233 | /** |
||
1234 | * Render input search tag |
||
1235 | * |
||
1236 | * @access public |
||
1237 | * |
||
1238 | * @param string $name search name |
||
1239 | * @param string $value search value |
||
1240 | * @param array $attributes attributes tag |
||
1241 | * |
||
1242 | * @return string |
||
1243 | * @static |
||
1244 | */ |
||
1245 | public static function searchField($name, $value = null, array $attributes = []) |
||
1249 | |||
1250 | /** |
||
1251 | * Render input tel tag |
||
1252 | * |
||
1253 | * @access public |
||
1254 | * |
||
1255 | * @param string $name telephone name |
||
1256 | * @param string $value telephone value |
||
1257 | * @param array $attributes attributes tag |
||
1258 | * |
||
1259 | * @return string |
||
1260 | * @static |
||
1261 | */ |
||
1262 | public static function telField($name, $value = null, array $attributes = []) |
||
1266 | |||
1267 | /** |
||
1268 | * Render input time tag |
||
1269 | * |
||
1270 | * @access public |
||
1271 | * |
||
1272 | * @param string $name time name |
||
1273 | * @param string $value time value |
||
1274 | * @param array $attributes attributes tag |
||
1275 | * |
||
1276 | * @return string |
||
1277 | * @static |
||
1278 | */ |
||
1279 | public static function timeField($name, $value = null, array $attributes = []) |
||
1283 | |||
1284 | /** |
||
1285 | * Render input url tag |
||
1286 | * |
||
1287 | * @access public |
||
1288 | * |
||
1289 | * @param string $name url name |
||
1290 | * @param string $value url path |
||
1291 | * @param array $attributes attributes tag |
||
1292 | * |
||
1293 | * @return string |
||
1294 | * @static |
||
1295 | */ |
||
1296 | public static function urlField($name, $value = null, array $attributes = []) |
||
1300 | |||
1301 | /** |
||
1302 | * Render input month tag |
||
1303 | * |
||
1304 | * @access public |
||
1305 | * |
||
1306 | * @param string $name month name |
||
1307 | * @param string $value month value |
||
1308 | * @param array $attributes attributes tag |
||
1309 | * |
||
1310 | * @return string |
||
1311 | * @static |
||
1312 | */ |
||
1313 | public static function monthField($name, $value = null, array $attributes = []) |
||
1317 | |||
1318 | /** |
||
1319 | * Render input week tag |
||
1320 | * |
||
1321 | * @access public |
||
1322 | * |
||
1323 | * @param string $name week name |
||
1324 | * @param string $value week value |
||
1325 | * @param array $attributes attributes tag |
||
1326 | * |
||
1327 | * @return string |
||
1328 | * @static |
||
1329 | */ |
||
1330 | public static function weekField($name, $value = null, array $attributes = []) |
||
1334 | |||
1335 | // HTML5 Only |
||
1336 | /** |
||
1337 | * Render charset tag |
||
1338 | * |
||
1339 | * @access public |
||
1340 | * |
||
1341 | * @param string $name charset name |
||
1342 | * |
||
1343 | * @return string |
||
1344 | * @static |
||
1345 | */ |
||
1346 | public static function charset($name) |
||
1350 | |||
1351 | /** |
||
1352 | * Render video tag |
||
1353 | * |
||
1354 | * @access public |
||
1355 | * |
||
1356 | * @param array $sources format type=>src |
||
1357 | * @param array $tracks format array(kind, src, srclang, label) |
||
1358 | * @param array $attributes attributes tag |
||
1359 | * @param string $noCodec text |
||
1360 | * |
||
1361 | * @return string |
||
1362 | * @static |
||
1363 | */ |
||
1364 | View Code Duplication | public static function video(array $sources = [], array $tracks = [], array $attributes = [], $noCodec = '') |
|
1381 | |||
1382 | /** |
||
1383 | * Render audio tag |
||
1384 | * |
||
1385 | * @access public |
||
1386 | * |
||
1387 | * @param array $sources format type=>src |
||
1388 | * @param array $tracks format array(kind, src, srclang, label) |
||
1389 | * @param array $attributes attributes tag |
||
1390 | * @param string $noCodec text |
||
1391 | * |
||
1392 | * @return string |
||
1393 | * @static |
||
1394 | */ |
||
1395 | View Code Duplication | public static function audio(array $sources = [], array $tracks = [], array $attributes = [], $noCodec = '') |
|
1412 | |||
1413 | /** |
||
1414 | * Render canvas tag |
||
1415 | * |
||
1416 | * @access public |
||
1417 | * |
||
1418 | * @param array $attributes attributes tag |
||
1419 | * @param string $noCodec text |
||
1420 | * |
||
1421 | * @return string |
||
1422 | * @static |
||
1423 | */ |
||
1424 | public static function canvas(array $attributes = [], $noCodec = '') |
||
1428 | } |
||
1429 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.