Repository navigation
Expand file tree
/
Copy pathApplication.php
More file actions
220 lines (186 loc) · 4.9 KB
/
Copy pathApplication.php
File metadata and controls
220 lines (186 loc) · 4.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
<?php
/**
* Application Contract interface file.
*
* @package Mantle
*/
namespace Mantle\Contracts;
use RuntimeException;
use Mantle\Contracts\Kernel as Kernel_Contract;
use Mantle\Support\Service_Provider;
/**
* Application Contract
*/
interface Application extends Container {
/**
* Getter for the base path.
*
* @param string $path Path to append.
*/
public function get_base_path( string $path = '' ): string;
/**
* Set the base path for a application.
*
* @param string $path Path to set.
*/
public function set_base_path( string $path );
/**
* Get the path to the application "app" directory.
*
* @param string $path Path to append, optional.
*/
public function get_app_path( string $path = '' ): string;
/**
* Set the application directory.
*
* @param string $path Path to use.
* @return static
*/
public function set_app_path( string $path );
/**
* Getter for the bootstrap path.
*
* @param string $path Path to append.
*/
public function get_bootstrap_path( string $path = '' ): string;
/**
* Set the root URL of the application.
*
* @param string $url Root URL to set.
*/
public function set_root_url( string $url );
/**
* Getter for the root URL.
* This would be the root URL to the WordPress installation.
*
* @param string $path Path to append.
*/
public function get_root_url( string $path = '' ): string;
/**
* Get the cache folder root.
* Folder that stores all compiled server-side assets for the application.
*/
public function get_cache_path(): string;
/**
* Get the cached Composer packages path.
*
* Used to store all auto-loaded packages that are Composer dependencies.
*/
public function get_cached_packages_path(): string;
/**
* Get the cached model manifest path.
* Used to store all auto-registered models that are in the application.
*/
public function get_cached_models_path(): string;
/**
* Get the path to the application configuration files.
*/
public function get_config_path(): string;
/**
* Determine if the application has been bootstrapped before.
*/
public function has_been_bootstrapped(): bool;
/**
* Get the Application's Environment
*/
public function environment(): string;
/**
* Check if the Application's Environment matches a list.
*
* @param string|array ...$environments Environments to check.
*/
public function is_environment( ...$environments ): bool;
/**
* Get the application namespace.
*
* @throws RuntimeException Thrown on error determining namespace.
*/
public function get_namespace(): string;
/**
* Alias to get_namespace().
*
* @throws RuntimeException Thrown on error determining namespace.
*/
public function namespace(): string;
/**
* Check if the application is running in the console.
*/
public function is_running_in_console(): bool;
/**
* Check if the application is running in console isolation mode.
*/
public function is_running_in_console_isolation(): bool;
/**
* Determine if the application has booted.
*/
public function is_booted(): bool;
/**
* Boot the application's service providers.
*/
public function boot();
/**
* Register a new boot listener.
*
* @param callable $callback Callback for the listener.
*/
public function booting( callable $callback ): static;
/**
* Register a new "booted" listener.
*
* @param callable $callback Callback for the listener.
*/
public function booted( callable $callback ): static;
/**
* Register a new terminating callback.
*
* @param callable $callback Callback for the listener.
*/
public function terminating( callable $callback ): static;
/**
* Terminate the application.
*/
public function terminate(): void;
/**
* Run the given array of bootstrap classes.
*
* Bootstrap classes should implement `Mantle\Contracts\Bootstrapable`.
*
* @param string[] $bootstrappers Class names of packages to boot.
* @param Kernel_Contract $kernel Kernel instance.
*/
public function bootstrap_with( array $bootstrappers, Kernel_Contract $kernel );
/**
* Get an instance of a service provider.
*
* @param string $name Provider class name.
*/
public function get_provider( string $name ): ?Service_Provider;
/**
* Get all service providers.
*
* @return Service_Provider[]
*/
public function get_providers(): array;
/**
* Determine if the application is cached.
*/
public function is_configuration_cached(): bool;
/**
* Retrieve the cached configuration path.
*/
public function get_cached_config_path(): string;
/**
* Determine if events are cached.
*/
public function is_events_cached(): bool;
/**
* Retrieve the cached configuration path.
*/
public function get_cached_events_path(): string;
/**
* Register a service provider.
*
* @param Service_Provider|class-string<Service_Provider> $provider Provider to register.
*/
public function register( Service_Provider|string $provider ): static;
}