1 | <?php namespace Arcanesoft\Core\Helpers\UI; |
||
8 | class Link implements Htmlable |
||
9 | { |
||
10 | /* ----------------------------------------------------------------- |
||
11 | | Properties |
||
12 | | ----------------------------------------------------------------- |
||
13 | */ |
||
14 | /** @var string */ |
||
15 | protected $url; |
||
16 | |||
17 | /** @var string */ |
||
18 | protected $title; |
||
19 | |||
20 | /** @var string */ |
||
21 | protected $icon; |
||
22 | |||
23 | /** @var array */ |
||
24 | protected $attributes = []; |
||
25 | |||
26 | /* ----------------------------------------------------------------- |
||
27 | | Constructor |
||
28 | | ----------------------------------------------------------------- |
||
29 | */ |
||
30 | /** |
||
31 | * Link constructor. |
||
32 | */ |
||
33 | 6 | public function __construct() |
|
37 | |||
38 | /* ----------------------------------------------------------------- |
||
39 | | Getters & Setters |
||
40 | | ----------------------------------------------------------------- |
||
41 | */ |
||
42 | 3 | public function setUrl($url) |
|
48 | |||
49 | /** |
||
50 | * Set the title. |
||
51 | * |
||
52 | * @param string $title |
||
53 | * |
||
54 | * @return self |
||
55 | */ |
||
56 | 3 | public function setTitle($title) |
|
62 | |||
63 | /** |
||
64 | * Set the icon. |
||
65 | * |
||
66 | * @param string $icon |
||
67 | * |
||
68 | * @return self |
||
69 | */ |
||
70 | 3 | public function setIcon($icon) |
|
76 | |||
77 | /** |
||
78 | * Set the attributes. |
||
79 | * |
||
80 | * @param array $attributes |
||
81 | * |
||
82 | * @return self |
||
83 | */ |
||
84 | 3 | public function setAttributes(array $attributes) |
|
90 | |||
91 | /* ----------------------------------------------------------------- |
||
92 | | Main Methods |
||
93 | | ----------------------------------------------------------------- |
||
94 | */ |
||
95 | /** |
||
96 | * @param string $url |
||
97 | * @param string $title |
||
98 | * @param array $attributes |
||
99 | * @param bool $withIcon |
||
100 | * |
||
101 | * @return self |
||
102 | */ |
||
103 | 3 | public function addLink($url, $title = null, array $attributes = [], $withIcon = true) |
|
109 | |||
110 | /** |
||
111 | * @param string $action |
||
112 | * @param string $url |
||
113 | * @param string $title |
||
114 | * @param array $attributes |
||
115 | * @param bool $withIcon |
||
116 | * |
||
117 | * @return self |
||
118 | */ |
||
119 | 3 | public function build($action, $url, $title = null, array $attributes = [], $withIcon) |
|
129 | |||
130 | /** |
||
131 | * Render the link. |
||
132 | * |
||
133 | * @return \Illuminate\Support\HtmlString |
||
134 | */ |
||
135 | 3 | public function render() |
|
144 | |||
145 | /** |
||
146 | * Get content as a string of HTML. |
||
147 | * |
||
148 | * @return string |
||
149 | */ |
||
150 | 3 | public function toHtml() |
|
154 | |||
155 | /* ----------------------------------------------------------------- |
||
156 | | Check Functions |
||
157 | | ----------------------------------------------------------------- |
||
158 | */ |
||
159 | /** |
||
160 | * Render the icon. |
||
161 | * |
||
162 | * @return string |
||
163 | */ |
||
164 | 3 | private function renderIcon() |
|
168 | |||
169 | /** |
||
170 | * Check if the icon exists. |
||
171 | * |
||
172 | * @return bool |
||
173 | */ |
||
174 | 3 | protected function hasIcon() |
|
178 | |||
179 | /** |
||
180 | * Get the title. |
||
181 | * |
||
182 | * @return string |
||
183 | */ |
||
184 | 3 | private function title() |
|
193 | |||
194 | 3 | private function getIconFromAction($action) |
|
202 | } |
||
203 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: