1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace LaravelZero\Framework; |
4
|
|
|
|
5
|
|
|
use Illuminate\Container\Container as BaseContainer; |
6
|
|
|
use LaravelZero\Framework\Exceptions\NotImplementedException; |
7
|
|
|
use Illuminate\Contracts\Foundation\Application as LaravelApplication; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* This is the Laravel Zero Framework container class. |
11
|
|
|
* |
12
|
|
|
* @author Nuno Maduro <[email protected]> |
13
|
|
|
*/ |
14
|
|
|
class Container extends BaseContainer implements LaravelApplication |
15
|
|
|
{ |
16
|
|
|
/** |
17
|
|
|
* {@inheritdoc} |
18
|
|
|
*/ |
19
|
|
|
public function version() |
20
|
|
|
{ |
21
|
|
|
return config('app.name'); |
22
|
|
|
} |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* Get the base path of the Laravel installation. |
26
|
|
|
* |
27
|
|
|
* @param string $path |
28
|
|
|
* @return string |
29
|
|
|
*/ |
30
|
|
|
public function basePath($path = '') |
31
|
|
|
{ |
32
|
|
|
return BASE_PATH.($path ? "/$path" : $path); |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* Get the path to the application configuration files. |
37
|
|
|
* |
38
|
|
|
* @param string $path |
39
|
|
|
* @return string |
40
|
|
|
*/ |
41
|
|
|
public function configPath($path = '') |
42
|
|
|
{ |
43
|
|
|
return BASE_PATH.'/config'.($path ? "/$path" : $path); |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Get the path to the database directory. |
48
|
|
|
* |
49
|
|
|
* @param string $path |
50
|
|
|
* @return string |
51
|
|
|
*/ |
52
|
|
|
public function databasePath($path = '') |
53
|
|
|
{ |
54
|
|
|
return config('database.path') ?: (BASE_PATH.'/database'.($path ? "/$path" : $path)); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* Get the path to the language files. |
59
|
|
|
* |
60
|
|
|
* @return string |
61
|
|
|
*/ |
62
|
|
|
public function langPath() |
63
|
|
|
{ |
64
|
|
|
return $this->resourcePath('lang'); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* Get the path to the resources directory. |
69
|
|
|
* |
70
|
|
|
* @param string $path |
71
|
|
|
* @return string |
72
|
|
|
*/ |
73
|
|
|
public function resourcePath($path = '') |
74
|
|
|
{ |
75
|
|
|
return BASE_PATH.'/resources'.($path ? "/$path" : $path); |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* Get the path to the storage directory. |
80
|
|
|
* |
81
|
|
|
* @return string |
82
|
|
|
*/ |
83
|
|
|
public function storagePath() |
84
|
|
|
{ |
85
|
|
|
return BASE_PATH.'/storage'; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* {@inheritdoc} |
90
|
|
|
*/ |
91
|
|
|
public function environment() |
92
|
|
|
{ |
93
|
|
|
return config('app.production') ? 'production' : 'development'; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* {@inheritdoc} |
98
|
|
|
*/ |
99
|
|
|
public function runningInConsole() |
100
|
|
|
{ |
101
|
|
|
return true; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* {@inheritdoc} |
106
|
|
|
*/ |
107
|
|
|
public function getNamespace() |
108
|
|
|
{ |
109
|
|
|
return 'App'; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* {@inheritdoc} |
114
|
|
|
*/ |
115
|
|
|
public function isDownForMaintenance() |
116
|
|
|
{ |
117
|
|
|
return false; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* {@inheritdoc} |
122
|
|
|
*/ |
123
|
|
|
public function registerConfiguredProviders() |
124
|
|
|
{ |
125
|
|
|
throw new NotImplementedException; |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* {@inheritdoc} |
130
|
|
|
*/ |
131
|
|
|
public function register($provider, $options = [], $force = false) |
132
|
|
|
{ |
133
|
|
|
throw new NotImplementedException; |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* {@inheritdoc} |
138
|
|
|
*/ |
139
|
|
|
public function registerDeferredProvider($provider, $service = null) |
140
|
|
|
{ |
141
|
|
|
throw new NotImplementedException; |
142
|
|
|
} |
143
|
|
|
|
144
|
|
|
/** |
145
|
|
|
* {@inheritdoc} |
146
|
|
|
*/ |
147
|
|
|
public function boot() |
148
|
|
|
{ |
149
|
|
|
throw new NotImplementedException; |
150
|
|
|
} |
151
|
|
|
|
152
|
|
|
/** |
153
|
|
|
* {@inheritdoc} |
154
|
|
|
*/ |
155
|
|
|
public function booting($callback) |
156
|
|
|
{ |
157
|
|
|
throw new NotImplementedException; |
158
|
|
|
} |
159
|
|
|
|
160
|
|
|
/** |
161
|
|
|
* {@inheritdoc} |
162
|
|
|
*/ |
163
|
|
|
public function booted($callback) |
164
|
|
|
{ |
165
|
|
|
throw new NotImplementedException; |
166
|
|
|
} |
167
|
|
|
|
168
|
|
|
/** |
169
|
|
|
* {@inheritdoc} |
170
|
|
|
*/ |
171
|
|
|
public function getCachedServicesPath() |
172
|
|
|
{ |
173
|
|
|
throw new NotImplementedException; |
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
/** |
177
|
|
|
* {@inheritdoc} |
178
|
|
|
*/ |
179
|
|
|
public function getCachedPackagesPath() |
180
|
|
|
{ |
181
|
|
|
throw new NotImplementedException; |
182
|
|
|
} |
183
|
|
|
} |
184
|
|
|
|