|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
use LaravelZero\Framework\Container; |
|
4
|
|
|
|
|
5
|
|
|
if (! function_exists('abort')) { |
|
6
|
|
|
/** |
|
7
|
|
|
* Throw an Console Exception with the given data. |
|
8
|
|
|
* |
|
9
|
|
|
* @param int $code |
|
10
|
|
|
* @param string $message |
|
11
|
|
|
* @param array $headers |
|
12
|
|
|
* @return void |
|
13
|
|
|
* |
|
14
|
|
|
* @throws \Symfony\Component\Console\Exception\CommandNotFoundException |
|
15
|
|
|
* @throws \LaravelZero\Framework\Contracts\Exceptions\ConsoleException |
|
16
|
|
|
*/ |
|
17
|
|
|
function abort($code, $message = '', array $headers = []) |
|
18
|
|
|
{ |
|
19
|
4 |
|
app()->abort($code, $message, $headers); |
|
20
|
3 |
|
} |
|
21
|
|
|
} |
|
22
|
|
|
if (! function_exists('abort_if')) { |
|
23
|
|
|
/** |
|
24
|
|
|
* Throw an Console Exception with the given data if the given condition is true. |
|
25
|
|
|
* |
|
26
|
|
|
* @param bool $boolean |
|
27
|
|
|
* @param int $code |
|
28
|
|
|
* @param string $message |
|
29
|
|
|
* @param array $headers |
|
30
|
|
|
* @return void |
|
31
|
|
|
* |
|
32
|
|
|
* @throws \Symfony\Component\Console\Exception\CommandNotFoundException |
|
33
|
|
|
* @throws \LaravelZero\Framework\Contracts\Exceptions\ConsoleException |
|
34
|
|
|
*/ |
|
35
|
|
|
function abort_if($boolean, $code, $message = '', array $headers = []) |
|
36
|
|
|
{ |
|
37
|
1 |
|
if ($boolean) { |
|
38
|
1 |
|
abort($code, $message, $headers); |
|
39
|
|
|
} |
|
40
|
1 |
|
} |
|
41
|
|
|
} |
|
42
|
|
|
if (! function_exists('abort_unless')) { |
|
43
|
|
|
/** |
|
44
|
|
|
* Throw an Console Exception with the given data unless the given condition is true. |
|
45
|
|
|
* |
|
46
|
|
|
* @param bool $boolean |
|
47
|
|
|
* @param int $code |
|
48
|
|
|
* @param string $message |
|
49
|
|
|
* @param array $headers |
|
50
|
|
|
* @return void |
|
51
|
|
|
* |
|
52
|
|
|
* @throws \Symfony\Component\Console\Exception\CommandNotFoundException |
|
53
|
|
|
* @throws \LaravelZero\Framework\Contracts\Exceptions\ConsoleException |
|
54
|
|
|
*/ |
|
55
|
|
|
function abort_unless($boolean, $code, $message = '', array $headers = []) |
|
56
|
|
|
{ |
|
57
|
1 |
|
if (! $boolean) { |
|
58
|
1 |
|
abort($code, $message, $headers); |
|
59
|
|
|
} |
|
60
|
1 |
|
} |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
if (! function_exists('app')) { |
|
64
|
|
|
/** |
|
65
|
|
|
* Get the available container instance. |
|
66
|
|
|
* |
|
67
|
|
|
* @param string $abstract |
|
68
|
|
|
* @param array $parameters |
|
69
|
|
|
* |
|
70
|
|
|
* @return mixed|\LaravelZero\Framework\Container |
|
71
|
|
|
*/ |
|
72
|
|
|
function app($abstract = null, array $parameters = []) |
|
73
|
|
|
{ |
|
74
|
51 |
|
if (is_null($abstract)) { |
|
75
|
51 |
|
return Container::getInstance(); |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
51 |
|
return Container::getInstance()->make($abstract, $parameters); |
|
79
|
|
|
} |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
if (! function_exists('app_path')) { |
|
83
|
|
|
/** |
|
84
|
|
|
* Get the path to the application folder. |
|
85
|
|
|
* |
|
86
|
|
|
* @param string $path |
|
87
|
|
|
* @return string |
|
88
|
|
|
*/ |
|
89
|
|
|
function app_path($path = '') |
|
90
|
|
|
{ |
|
91
|
51 |
|
return app('path').($path ? DIRECTORY_SEPARATOR.$path : $path); |
|
92
|
|
|
} |
|
93
|
|
|
} |
|
94
|
|
|
|
|
95
|
|
|
if (! function_exists('config')) { |
|
96
|
|
|
/** |
|
97
|
|
|
* Get / set the specified configuration value. |
|
98
|
|
|
* |
|
99
|
|
|
* If an array is passed as the key, we will assume you want to set an array of values. |
|
100
|
|
|
* |
|
101
|
|
|
* @param array|string $key |
|
102
|
|
|
* @param mixed $default |
|
103
|
|
|
* |
|
104
|
|
|
* @return mixed|\Illuminate\Config\Repository |
|
105
|
|
|
*/ |
|
106
|
|
|
function config($key = null, $default = null) |
|
107
|
|
|
{ |
|
108
|
51 |
|
if (is_null($key)) { |
|
109
|
1 |
|
return app('config'); |
|
110
|
|
|
} |
|
111
|
51 |
|
if (is_array($key)) { |
|
112
|
1 |
|
return app('config')->set($key); |
|
113
|
|
|
} |
|
114
|
|
|
|
|
115
|
51 |
|
return app('config')->get($key, $default); |
|
116
|
|
|
} |
|
117
|
|
|
} |
|
118
|
|
|
|
|
119
|
|
|
if (! function_exists('event')) { |
|
120
|
|
|
/** |
|
121
|
|
|
* Dispatch an event and call the listeners. |
|
122
|
|
|
* |
|
123
|
|
|
* @param mixed $event |
|
|
|
|
|
|
124
|
|
|
* @param mixed $payload |
|
|
|
|
|
|
125
|
|
|
* @param bool $halt |
|
|
|
|
|
|
126
|
|
|
* |
|
127
|
|
|
* @return array|null |
|
128
|
|
|
*/ |
|
129
|
|
|
function event(...$args) |
|
130
|
|
|
{ |
|
131
|
|
|
return app('events')->dispatch(...$args); |
|
132
|
|
|
} |
|
133
|
|
|
} |
|
134
|
|
|
|
|
135
|
|
|
if (! function_exists('base_path')) { |
|
136
|
|
|
/** |
|
137
|
|
|
* Get the path to the base of the install. |
|
138
|
|
|
* |
|
139
|
|
|
* @param string $path |
|
140
|
|
|
* |
|
141
|
|
|
* @return string |
|
142
|
|
|
*/ |
|
143
|
|
|
function base_path($path = '') |
|
144
|
|
|
{ |
|
145
|
51 |
|
return app()->basePath($path); |
|
146
|
|
|
} |
|
147
|
|
|
} |
|
148
|
|
|
|
|
149
|
|
|
if (! function_exists('config_path')) { |
|
150
|
|
|
/** |
|
151
|
|
|
* Get the configuration path. |
|
152
|
|
|
* |
|
153
|
|
|
* @param string $path |
|
154
|
|
|
* |
|
155
|
|
|
* @return string |
|
156
|
|
|
*/ |
|
157
|
|
|
function config_path($path = '') |
|
158
|
|
|
{ |
|
159
|
51 |
|
return app()->configPath($path); |
|
160
|
|
|
} |
|
161
|
|
|
} |
|
162
|
|
|
|
|
163
|
|
|
if (! function_exists('database_path')) { |
|
164
|
|
|
/** |
|
165
|
|
|
* Get the database path. |
|
166
|
|
|
* |
|
167
|
|
|
* @param string $path |
|
168
|
|
|
* |
|
169
|
|
|
* @return string |
|
170
|
|
|
*/ |
|
171
|
|
|
function database_path($path = '') |
|
172
|
|
|
{ |
|
173
|
51 |
|
return app()->databasePath($path); |
|
174
|
|
|
} |
|
175
|
|
|
} |
|
176
|
|
|
|
|
177
|
|
|
if (! function_exists('resource_path')) { |
|
178
|
|
|
/** |
|
179
|
|
|
* Get the path to the resources folder. |
|
180
|
|
|
* |
|
181
|
|
|
* @param string $path |
|
182
|
|
|
* |
|
183
|
|
|
* @return string |
|
184
|
|
|
*/ |
|
185
|
|
|
function resource_path($path = '') |
|
186
|
|
|
{ |
|
187
|
1 |
|
return app()->resourcePath($path); |
|
188
|
|
|
} |
|
189
|
|
|
} |
|
190
|
|
|
|
|
191
|
|
|
if (! function_exists('storage_path')) { |
|
192
|
|
|
/** |
|
193
|
|
|
* Get the path to the storage folder. |
|
194
|
|
|
* |
|
195
|
|
|
* @param string $path |
|
196
|
|
|
* |
|
197
|
|
|
* @return string |
|
198
|
|
|
*/ |
|
199
|
|
|
function storage_path($path = '') |
|
200
|
|
|
{ |
|
201
|
51 |
|
return app()->storagePath().($path ? DIRECTORY_SEPARATOR.$path : $path); |
|
202
|
|
|
} |
|
203
|
|
|
} |
|
204
|
|
|
|
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italyis not defined by the methodfinale(...).The most likely cause is that the parameter was removed, but the annotation was not.