1 | <?php |
||
16 | class LayoutHelper extends AppHelper |
||
17 | { |
||
18 | use StringTemplateTrait; |
||
19 | |||
20 | public $helpers = ['Html', 'Url']; |
||
21 | |||
22 | protected $_defaultConfig = [ |
||
23 | 'templates' => [ |
||
24 | 'dropdownMenuDivider' => '<div class="dropdown-divider"></div>', |
||
25 | 'dropdownMenu' => '<div class="dropdown" style="display: inline;">{{button}}<div id="{{id}}" class="dropdown-menu">{{menu}}</div></div>', |
||
26 | ] |
||
27 | ]; |
||
28 | |||
29 | /** |
||
30 | * Generates page heading html |
||
31 | * |
||
32 | * @param string $heading heading |
||
33 | * @param string $tag tag |
||
34 | * @return string |
||
35 | */ |
||
36 | public function pageHeading($heading, $tag = 'h1') |
||
44 | |||
45 | /** |
||
46 | * Generates intoText tag |
||
47 | * |
||
48 | * @param string $content content |
||
49 | * @return string |
||
50 | */ |
||
51 | public function infoText($content) |
||
55 | |||
56 | /** |
||
57 | * text with icon |
||
58 | * |
||
59 | * @param string $text text |
||
60 | * @param string $icon icon |
||
61 | * @return string |
||
62 | */ |
||
63 | public function textWithIcon($text, $icon): string |
||
72 | |||
73 | /** |
||
74 | * dropt down menu |
||
75 | * |
||
76 | * @param array $menuItems items |
||
77 | * @param array $options options |
||
78 | * @return string |
||
79 | */ |
||
80 | public function dropdownMenuButton(array $menuItems, array $options = []) |
||
117 | |||
118 | /** |
||
119 | * Creates panel heading HTML-element |
||
120 | * |
||
121 | * @param mixed $content content |
||
122 | * @param array $options options |
||
123 | * - `class` string [panel-heading] CSS class for element |
||
124 | * - `escape` bool [true] escape output |
||
125 | * - `pageHeading` bool [false] |
||
126 | * - `tag` string [h2] |
||
127 | * @return string |
||
128 | */ |
||
129 | public function panelHeading($content, array $options = []) |
||
157 | |||
158 | /** |
||
159 | * heading |
||
160 | * |
||
161 | * @param mixed $content content |
||
162 | * @param array $options options |
||
163 | * @return string |
||
164 | */ |
||
165 | public function heading($content, array $options = []) |
||
183 | |||
184 | /** |
||
185 | * creates a navigation link for the navigation bar |
||
186 | * |
||
187 | * @param string $content link content |
||
188 | * @param string $url link url |
||
189 | * @param array $options allows options as HtmlHelper::link |
||
190 | * - 'class' a CSS class to apply to the navbar item |
||
191 | * - 'position' [left]|center|right |
||
192 | * @return string navigation link |
||
193 | */ |
||
194 | public function navbarItem($content, $url, array $options = []) |
||
212 | |||
213 | /** |
||
214 | * navbar back |
||
215 | * |
||
216 | * @param string $url url |
||
217 | * @param string $title title |
||
218 | * @param array $options options |
||
219 | * @return string |
||
220 | */ |
||
221 | public function navbarBack($url = null, $title = null, $options = []) |
||
239 | } |
||
240 |
There are different options of fixing this problem.
If you want to be on the safe side, you can add an additional type-check:
If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:
Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.