1 | <?php namespace Arcanedev\LaravelHtml\Helpers; |
||
3 | class Lister |
||
4 | { |
||
5 | /* ------------------------------------------------------------------------------------------------ |
||
6 | | Main Functions |
||
7 | | ------------------------------------------------------------------------------------------------ |
||
8 | */ |
||
9 | /** |
||
10 | * Generate an ordered list of items. |
||
11 | * |
||
12 | * @param array $list |
||
13 | * @param array $attributes |
||
14 | * |
||
15 | * @return string |
||
16 | */ |
||
17 | 16 | public static function ol(array $list, array $attributes = []) |
|
21 | |||
22 | /** |
||
23 | * Generate an un-ordered list of items. |
||
24 | * |
||
25 | * @param array $list |
||
26 | * @param array $attributes |
||
27 | * |
||
28 | * @return string |
||
29 | */ |
||
30 | 16 | public static function ul(array $list, array $attributes = []) |
|
34 | |||
35 | /** |
||
36 | * Generate a description list of items. |
||
37 | * |
||
38 | * @param array $list |
||
39 | * @param array $attributes |
||
40 | * |
||
41 | * @return string |
||
42 | */ |
||
43 | 24 | public static function dl(array $list, array $attributes = []) |
|
59 | |||
60 | /** |
||
61 | * Create a listing HTML element. |
||
62 | * |
||
63 | * @param string $type |
||
64 | * @param array $list |
||
65 | * @param array $attributes |
||
66 | * |
||
67 | * @return string |
||
68 | */ |
||
69 | 24 | public static function make($type, array $list, array $attributes = []) |
|
78 | |||
79 | /* ------------------------------------------------------------------------------------------------ |
||
80 | | Other Functions |
||
81 | | ------------------------------------------------------------------------------------------------ |
||
82 | */ |
||
83 | /** |
||
84 | * Make listing elements. |
||
85 | * |
||
86 | * @param string $type |
||
87 | * @param array $list |
||
88 | * |
||
89 | * @return string |
||
90 | */ |
||
91 | 24 | private static function makeElements($type, array $list) |
|
104 | |||
105 | /** |
||
106 | * Create list element. |
||
107 | * |
||
108 | * @param mixed $key |
||
109 | * @param string $type |
||
110 | * @param mixed $value |
||
111 | * |
||
112 | * @return string |
||
113 | */ |
||
114 | 24 | private static function makeElement($key, $type, $value) |
|
120 | |||
121 | /** |
||
122 | * Create a nested list attribute. |
||
123 | * |
||
124 | * @param mixed $key |
||
125 | * @param string $type |
||
126 | * @param mixed $value |
||
127 | * |
||
128 | * @return string |
||
129 | */ |
||
130 | 8 | private static function makeNestedElements($key, $type, $value) |
|
136 | } |
||
137 |
Let’s assume you have a class which uses late-static binding:
}
The code above will run fine in your PHP runtime. However, if you now create a sub-class and call the
getSomeVariable()
on that sub-class, you will receive a runtime error:In the case above, it makes sense to update
SomeClass
to useself
instead: