1
|
|
|
<?php namespace Arcanedev\LogViewer; |
2
|
|
|
|
3
|
|
|
use Arcanedev\Support\PackageServiceProvider as ServiceProvider; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* Class LogViewerServiceProvider |
7
|
|
|
* |
8
|
|
|
* @package Arcanedev\LogViewer |
9
|
|
|
* @author ARCANEDEV <[email protected]> |
10
|
|
|
*/ |
11
|
|
|
class LogViewerServiceProvider extends ServiceProvider |
12
|
|
|
{ |
13
|
|
|
/* ------------------------------------------------------------------------------------------------ |
14
|
|
|
| Properties |
15
|
|
|
| ------------------------------------------------------------------------------------------------ |
16
|
|
|
*/ |
17
|
|
|
/** |
18
|
|
|
* Vendor name. |
19
|
|
|
* |
20
|
|
|
* @var string |
21
|
|
|
*/ |
22
|
|
|
protected $vendor = 'arcanedev'; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* Package name. |
26
|
|
|
* |
27
|
|
|
* @var string |
28
|
|
|
*/ |
29
|
|
|
protected $package = 'log-viewer'; |
30
|
|
|
|
31
|
|
|
/* ------------------------------------------------------------------------------------------------ |
32
|
|
|
| Getters & Setters |
33
|
|
|
| ------------------------------------------------------------------------------------------------ |
34
|
|
|
*/ |
35
|
|
|
/** |
36
|
|
|
* Get the base path. |
37
|
|
|
* |
38
|
|
|
* @return string |
39
|
|
|
*/ |
40
|
1548 |
|
public function getBasePath() |
41
|
|
|
{ |
42
|
1548 |
|
return dirname(__DIR__); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
/* ------------------------------------------------------------------------------------------------ |
46
|
|
|
| Main Functions |
47
|
|
|
| ------------------------------------------------------------------------------------------------ |
48
|
|
|
*/ |
49
|
|
|
/** |
50
|
|
|
* Register the service provider. |
51
|
|
|
*/ |
52
|
1548 |
|
public function register() |
53
|
|
|
{ |
54
|
1548 |
|
$this->registerConfig(); |
55
|
|
|
|
56
|
1548 |
|
$this->app->register('Arcanedev\\LogViewer\\Providers\\UtilitiesServiceProvider'); |
57
|
1548 |
|
$this->registerLogViewer(); |
58
|
1548 |
|
$this->registerAliases(); |
59
|
|
|
|
60
|
1548 |
|
if ($this->app->runningInConsole()) { |
61
|
1548 |
|
$this->app->register('Arcanedev\\LogViewer\\Providers\\CommandsServiceProvider'); |
62
|
1161 |
|
} |
63
|
1548 |
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* Boot the service provider. |
67
|
|
|
*/ |
68
|
1548 |
|
public function boot() |
69
|
|
|
{ |
70
|
1548 |
|
$this->publishConfig(); |
|
|
|
|
71
|
1548 |
|
$this->publishViews(); |
|
|
|
|
72
|
1548 |
|
$this->publishTranslations(); |
|
|
|
|
73
|
1548 |
|
$this->app->register('Arcanedev\\LogViewer\\Providers\\RouteServiceProvider'); |
74
|
1548 |
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* Get the services provided by the provider. |
78
|
|
|
* |
79
|
|
|
* @return array |
80
|
|
|
*/ |
81
|
780 |
|
public function provides() |
82
|
387 |
|
{ |
83
|
387 |
|
return [ |
84
|
12 |
|
'arcanedev.log-viewer', |
85
|
9 |
|
'Arcanedev\\LogViewer\\Contracts\\LogViewerInterface', |
86
|
9 |
|
]; |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/* ------------------------------------------------------------------------------------------------ |
90
|
|
|
| Services Functions |
91
|
|
|
| ------------------------------------------------------------------------------------------------ |
92
|
|
|
*/ |
93
|
|
|
/** |
94
|
|
|
* Register the log data class. |
95
|
|
|
*/ |
96
|
1548 |
|
private function registerLogViewer() |
97
|
|
|
{ |
98
|
1548 |
|
$this->singleton( |
99
|
1548 |
|
'arcanedev.log-viewer', |
100
|
1548 |
|
'Arcanedev\\LogViewer\\LogViewer' |
101
|
1548 |
|
); |
102
|
|
|
|
103
|
|
|
$this->bind( |
104
|
|
|
'Arcanedev\\LogViewer\\Contracts\\LogViewerInterface', |
105
|
|
|
'arcanedev.log-viewer' |
106
|
1548 |
|
); |
107
|
|
|
|
108
|
1548 |
|
// Registering the Facade |
109
|
|
|
$this->alias( |
110
|
1548 |
|
$this->app['config']->get('log-viewer.facade', 'LogViewer'), |
111
|
1548 |
|
'Arcanedev\\LogViewer\\Facades\\LogViewer' |
112
|
1548 |
|
); |
113
|
1548 |
|
} |
114
|
|
|
} |
115
|
|
|
|
If you implement
__call
and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__call
is implemented by a parent class and only the child class knows which methods exist: