1 | <?php |
||
9 | class Flare |
||
10 | { |
||
11 | /** |
||
12 | * The Flare version. |
||
13 | * |
||
14 | * @var string |
||
15 | */ |
||
16 | const VERSION = '0.9.x-dev'; |
||
17 | |||
18 | /** |
||
19 | * Array of expected configuration keys |
||
20 | * with the absolute bare-minimum defaults. |
||
21 | * |
||
22 | * @var array |
||
23 | */ |
||
24 | protected $configurationKeys = [ |
||
25 | 'admin_title' => 'Laravel Flare', |
||
26 | 'admin_url' => 'admin', |
||
27 | 'admin_theme' => 'red', |
||
28 | 'admin' => [], |
||
29 | 'attributes' => [], |
||
30 | 'models' => [], |
||
31 | 'modules' => [], |
||
32 | 'widgets' => [], |
||
33 | 'permissions' => \LaravelFlare\Flare\Permissions\Permissions::class, |
||
34 | 'policies' => [], |
||
35 | 'show' => [ |
||
36 | 'github' => true, |
||
37 | 'login' => true, |
||
38 | 'notifications' => true, |
||
39 | 'version' => true, |
||
40 | ] |
||
41 | ]; |
||
42 | |||
43 | /** |
||
44 | * Admin Manager |
||
45 | * |
||
46 | * @var \LaravelFlare\Flare\Admin\AdminManager |
||
47 | */ |
||
48 | protected $admin; |
||
49 | |||
50 | /** |
||
51 | * Flare Configuration |
||
52 | * |
||
53 | * @var array |
||
54 | */ |
||
55 | protected $config; |
||
56 | |||
57 | /** |
||
58 | * The Title of the Admin Panel |
||
59 | * |
||
60 | * @var string |
||
61 | */ |
||
62 | protected $adminTitle; |
||
63 | |||
64 | /** |
||
65 | * Safe Title of the Admin Panel |
||
66 | * |
||
67 | * @var string |
||
68 | */ |
||
69 | protected $safeAdminTitle; |
||
70 | |||
71 | /** |
||
72 | * Relative Base URL of Admin Panel |
||
73 | * |
||
74 | * @var string |
||
75 | */ |
||
76 | protected $relativeAdminUrl; |
||
77 | |||
78 | /** |
||
79 | * __construct. |
||
80 | */ |
||
81 | public function __construct(AdminManager $adminManager) |
||
87 | |||
88 | /** |
||
89 | * Returns the instance of the Admin Manager |
||
90 | * |
||
91 | * @return \LaravelFlare\Flare\Admin\AdminManager |
||
92 | */ |
||
93 | public function admin() |
||
97 | |||
98 | /** |
||
99 | * Returns a Flare configuration value(s). |
||
100 | * |
||
101 | * @param string $key |
||
102 | * |
||
103 | * @return mixed |
||
104 | */ |
||
105 | public function config($key) |
||
109 | |||
110 | /** |
||
111 | * Returns a Flare configuration value(s), falling back |
||
112 | * to the defined bare-minimum configuration defaults |
||
113 | * if, for whatever reason the config is undefined. |
||
114 | * |
||
115 | * @param string $key |
||
116 | * |
||
117 | * @return mixed |
||
118 | */ |
||
119 | public function getConfig($key) |
||
127 | |||
128 | /** |
||
129 | * Allow setting of the Flare config at runtime. |
||
130 | * |
||
131 | * @return void |
||
132 | */ |
||
133 | public function setConfig() |
||
137 | |||
138 | /** |
||
139 | * Set the loaded config to the protected property. |
||
140 | * |
||
141 | * @return void |
||
142 | */ |
||
143 | public function setLoadedConfig() |
||
147 | |||
148 | /** |
||
149 | * @return string |
||
150 | * |
||
151 | * @deprecated 0.9 Use getAdminTitle() instead. |
||
152 | */ |
||
153 | public function adminTitle() |
||
157 | |||
158 | /** |
||
159 | * Returns the defined Admin Title. |
||
160 | * |
||
161 | * @return string |
||
162 | */ |
||
163 | public function getAdminTitle() |
||
167 | |||
168 | /** |
||
169 | * Sets the Admin Title |
||
170 | * |
||
171 | * @param mixed $title |
||
172 | * |
||
173 | * @return void |
||
174 | */ |
||
175 | public function setAdminTitle($title = null) |
||
179 | |||
180 | /** |
||
181 | * @return string |
||
182 | * |
||
183 | * @deprecated 0.9 Use getSafeAdminTitle() instead. |
||
184 | */ |
||
185 | public function safeAdminTitle() |
||
189 | |||
190 | /** |
||
191 | * Returns the defined Admin Title, converted |
||
192 | * to a safer format (for <title> tags etc.). |
||
193 | * |
||
194 | * @return string |
||
195 | */ |
||
196 | public function getSafeAdminTitle() |
||
200 | |||
201 | /** |
||
202 | * Sets the Safe Admin Title which is used |
||
203 | * in <title> tags etc. |
||
204 | * |
||
205 | * @param mixed $title |
||
206 | * |
||
207 | * @return void |
||
208 | */ |
||
209 | public function setSafeAdminTitle($title = null) |
||
213 | |||
214 | /** |
||
215 | * Returns URL to a path in the Admin Panel, using the |
||
216 | * Admin URL defined in the Flare Config. |
||
217 | * |
||
218 | * @param string $path |
||
219 | * |
||
220 | * @return string |
||
221 | */ |
||
222 | public function adminUrl($path = '') |
||
226 | |||
227 | /** |
||
228 | * Returns URL to a path in the Admin Panel, using the |
||
229 | * Admin URL defined in the Flare Config. |
||
230 | * |
||
231 | * @param string $path |
||
232 | * |
||
233 | * @return string |
||
234 | */ |
||
235 | public function relativeAdminUrl($path = '') |
||
239 | |||
240 | /** |
||
241 | * Returns URL to a path in the Admin Panel, using the |
||
242 | * Admin URL defined in the Flare Config. |
||
243 | * |
||
244 | * @return string |
||
245 | */ |
||
246 | public function getRelativeAdminUrl() |
||
250 | |||
251 | /** |
||
252 | * Set the Flare Relative Admin URL. |
||
253 | * |
||
254 | * If the provided path is null the relative path provided |
||
255 | * with the getRelativeAdminUrl() method will return the |
||
256 | * configuration file default (or the Flare fallbacks). |
||
257 | * |
||
258 | * @param mixed $path |
||
259 | */ |
||
260 | public function setRelativeAdminUrl($path = null) |
||
264 | |||
265 | /** |
||
266 | * Returns URL to a path in the Flare Documentation. |
||
267 | * This is COMING SOON! |
||
268 | * |
||
269 | * @param string $path |
||
270 | * |
||
271 | * @return string |
||
272 | */ |
||
273 | public function docsUrl($path = '') |
||
277 | |||
278 | /** |
||
279 | * Determines whether part of the Flare Admin Panel |
||
280 | * should be displayed or not and returns true / false. |
||
281 | * |
||
282 | * @param string $key |
||
283 | * |
||
284 | * @return boolean |
||
285 | */ |
||
286 | public function show($key = false) |
||
294 | |||
295 | /** |
||
296 | * Determines whether part of the Flare Admin Panel |
||
297 | * should be displayed or not and returns true / false. |
||
298 | * |
||
299 | * Accessor for getShow(). |
||
300 | * |
||
301 | * @param string $key |
||
302 | * |
||
303 | * @return boolean |
||
304 | */ |
||
305 | public function getShow($key = false) |
||
311 | |||
312 | /** |
||
313 | * Returns the current Flare Version. |
||
314 | * |
||
315 | * @return string |
||
316 | */ |
||
317 | public function version() |
||
321 | |||
322 | /** |
||
323 | * Returns an array of all of the Available Attribute Types. |
||
324 | * |
||
325 | * @return array |
||
326 | */ |
||
327 | protected function availableAttributes() |
||
341 | |||
342 | /** |
||
343 | * Determines if an AttributeType class exists or not. |
||
344 | * |
||
345 | * @param string $type |
||
346 | * |
||
347 | * @return bool |
||
348 | */ |
||
349 | protected function attributeTypeExists($type) |
||
353 | |||
354 | /** |
||
355 | * Render Attribute. |
||
356 | * |
||
357 | * @param string $action |
||
358 | * @param string $attribute |
||
359 | * @param string $field |
||
360 | * @param string $model |
||
361 | * @param string $modelManager |
||
362 | * |
||
363 | * @return \Illuminate\Http\Response |
||
364 | */ |
||
365 | public function renderAttribute($action, $attribute, $field, $model, $modelManager) |
||
379 | |||
380 | /** |
||
381 | * Resolves the Class of an Attribute and returns it as a string. |
||
382 | * |
||
383 | * @param string $type |
||
384 | * |
||
385 | * @return string |
||
386 | */ |
||
387 | protected function resolveAttributeClass($type) |
||
397 | } |
||
398 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..