|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Displore\Machete; |
|
4
|
|
|
|
|
5
|
|
|
use Illuminate\Support\ServiceProvider; |
|
6
|
|
|
|
|
7
|
|
|
class MacheteServiceProvider extends ServiceProvider |
|
8
|
|
|
{ |
|
9
|
|
|
/** |
|
10
|
|
|
* Perform post-registration booting of services. |
|
11
|
|
|
*/ |
|
12
|
|
|
public function boot() |
|
13
|
|
|
{ |
|
14
|
|
|
// Adding all of the Blade directives if not disabled. |
|
15
|
|
|
if ($this->app->config->has('displore.services.directives')) { |
|
|
|
|
|
|
16
|
|
|
if ($this->app->config->get('displore.services.directives') == true) { |
|
|
|
|
|
|
17
|
|
|
$this->bindDirectives(); |
|
18
|
|
|
} |
|
19
|
|
|
} else { |
|
20
|
|
|
$this->bindDirectives(); |
|
21
|
|
|
} |
|
22
|
|
|
|
|
23
|
|
|
require __DIR__.'/helpers.php'; |
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* Register any package services. |
|
28
|
|
|
*/ |
|
29
|
|
|
public function register() |
|
30
|
|
|
{ |
|
31
|
|
|
// Binding the themes service if not disabled. |
|
32
|
|
|
if ($this->app->config->has('displore.services.themes')) { |
|
|
|
|
|
|
33
|
|
|
if ($this->app->config->get('displore.services.themes') == true) { |
|
|
|
|
|
|
34
|
|
|
$this->bindThemesService(); |
|
35
|
|
|
} |
|
36
|
|
|
} else { |
|
37
|
|
|
$this->bindThemesService(); |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
// Binding the widgets service if not disabled. |
|
41
|
|
|
if ($this->app->config->has('displore.services.widgets')) { |
|
|
|
|
|
|
42
|
|
|
if ($this->app->config->get('displore.services.widgets') == true) { |
|
|
|
|
|
|
43
|
|
|
$this->bindWidgetsService(); |
|
44
|
|
|
} |
|
45
|
|
|
} else { |
|
46
|
|
|
$this->bindWidgetsService(); |
|
47
|
|
|
} |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
protected function bindThemesService() |
|
51
|
|
|
{ |
|
52
|
|
|
$this->app->registerDeferredProvider( |
|
53
|
|
|
'Displore\Themes\ThemesServiceProvider', |
|
54
|
|
|
'Displore\Themes\Theme' |
|
55
|
|
|
); |
|
56
|
|
|
|
|
57
|
|
|
// The commands are not necessary on production servers. |
|
58
|
|
|
if ($this->app->environment('local')) { |
|
|
|
|
|
|
59
|
|
|
$this->commands(['Displore\Themes\ThemeCommand']); |
|
60
|
|
|
} |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
protected function bindWidgetsService() |
|
64
|
|
|
{ |
|
65
|
|
|
$this->app->register('Displore\Widgets\WidgetsServiceProvider'); |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
protected function bindDirectives() |
|
69
|
|
|
{ |
|
70
|
|
|
$directives = new Directives(); |
|
71
|
|
|
|
|
72
|
|
|
$directives->datetime(); |
|
73
|
|
|
$directives->ifLoggedIn(); |
|
74
|
|
|
$directives->layout(); |
|
75
|
|
|
$directives->limit(); |
|
76
|
|
|
$directives->partial(); |
|
77
|
|
|
$directives->title(); |
|
78
|
|
|
} |
|
79
|
|
|
} |
|
80
|
|
|
|
If you access a property on an interface, you most likely code against a concrete implementation of the interface.
Available Fixes
Adding an additional type check:
Changing the type hint: