1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* This file is part of the O2System PHP Framework package. |
4
|
|
|
* |
5
|
|
|
* For the full copyright and license information, please view the LICENSE |
6
|
|
|
* file that was distributed with this source code. |
7
|
|
|
* |
8
|
|
|
* @author Steeve Andrian Salim |
9
|
|
|
* @copyright Copyright (c) Steeve Andrian Salim |
10
|
|
|
*/ |
11
|
|
|
// ------------------------------------------------------------------------ |
12
|
|
|
|
13
|
|
|
if ( ! function_exists('o2system')) { |
14
|
|
|
/** |
15
|
|
|
* o2system |
16
|
|
|
* |
17
|
|
|
* Convenient shortcut for O2System Framework Instance |
18
|
|
|
* |
19
|
|
|
* @return O2System\Framework |
|
|
|
|
20
|
|
|
*/ |
21
|
|
|
function o2system() |
22
|
|
|
{ |
23
|
|
|
return O2System\Reactor::getInstance(); |
|
|
|
|
24
|
|
|
} |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
// ------------------------------------------------------------------------ |
28
|
|
|
|
29
|
|
|
if ( ! function_exists('loader')) { |
30
|
|
|
/** |
31
|
|
|
* loader |
32
|
|
|
* |
33
|
|
|
* Convenient shortcut for O2System Framework Loader service. |
34
|
|
|
* |
35
|
|
|
* @return O2System\Framework\Services\Loader |
|
|
|
|
36
|
|
|
*/ |
37
|
|
|
function loader() |
38
|
|
|
{ |
39
|
|
|
return services('loader'); |
|
|
|
|
40
|
|
|
} |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
// ------------------------------------------------------------------------ |
44
|
|
|
|
45
|
|
|
if ( ! function_exists('config')) { |
46
|
|
|
/** |
47
|
|
|
* config |
48
|
|
|
* |
49
|
|
|
* Convenient shortcut for O2System Framework Config service. |
50
|
|
|
* |
51
|
|
|
* @return O2System\Framework\Services\Config|\O2System\Kernel\Datastructures\Config |
|
|
|
|
52
|
|
|
*/ |
53
|
|
|
function config() |
54
|
|
|
{ |
55
|
|
|
$args = func_get_args(); |
56
|
|
|
|
57
|
|
|
if ($countArgs = count($args)) { |
58
|
|
|
if(services()->has('config')) { |
59
|
|
|
$config = services('config'); |
60
|
|
|
|
61
|
|
|
if ($countArgs == 1) { |
62
|
|
|
return call_user_func_array([&$config, 'getItem'], $args); |
63
|
|
|
} else { |
64
|
|
|
return call_user_func_array([&$config, 'loadFile'], $args); |
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
return services('config'); |
|
|
|
|
70
|
|
|
} |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
// ------------------------------------------------------------------------ |
74
|
|
|
|
75
|
|
|
if ( ! function_exists('cache')) { |
76
|
|
|
/** |
77
|
|
|
* cache |
78
|
|
|
* |
79
|
|
|
* Convenient shortcut for O2System Framework Cache service. |
80
|
|
|
* |
81
|
|
|
* @return O2System\Framework\Services\Cache|boolean Returns FALSE if service not exists. |
|
|
|
|
82
|
|
|
*/ |
83
|
|
|
function cache() |
84
|
|
|
{ |
85
|
|
|
if(services()->has('cache')) { |
86
|
|
|
return services()->get('cache'); |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
return false; |
90
|
|
|
} |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
// ------------------------------------------------------------------------ |
94
|
|
|
|
95
|
|
|
if ( ! function_exists('hooks')) { |
96
|
|
|
/** |
97
|
|
|
* hooks |
98
|
|
|
* |
99
|
|
|
* Convenient shortcut for O2System Framework Hooks service. |
100
|
|
|
* |
101
|
|
|
* @return O2System\Framework\Services\Hooks Returns FALSE if service not exists. |
|
|
|
|
102
|
|
|
*/ |
103
|
|
|
function hooks() |
104
|
|
|
{ |
105
|
|
|
if(services()->has('hooks')) { |
106
|
|
|
return services()->get('hooks'); |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
return false; |
|
|
|
|
110
|
|
|
} |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
// ------------------------------------------------------------------------ |
114
|
|
|
|
115
|
|
|
if ( ! function_exists('database')) { |
116
|
|
|
/** |
117
|
|
|
* database |
118
|
|
|
* |
119
|
|
|
* Convenient shortcut for O2System Framework Database Connection pools. |
120
|
|
|
* |
121
|
|
|
* @return O2System\Database\Connections |
122
|
|
|
*/ |
123
|
|
|
function database() |
124
|
|
|
{ |
125
|
|
|
return models()->database; |
126
|
|
|
} |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
// ------------------------------------------------------------------------ |
130
|
|
|
|
131
|
|
|
if ( ! function_exists('models')) { |
132
|
|
|
/** |
133
|
|
|
* models |
134
|
|
|
* |
135
|
|
|
* Convenient shortcut for O2System Framework Models container. |
136
|
|
|
* |
137
|
|
|
* @return O2System\Framework\Containers\Models|O2System\Framework\Models\Sql\Model|O2System\Framework\Models\NoSql\Model |
|
|
|
|
138
|
|
|
*/ |
139
|
|
|
function models() |
140
|
|
|
{ |
141
|
|
|
$args = func_get_args(); |
142
|
|
|
|
143
|
|
|
if (count($args)) { |
144
|
|
|
return o2system()->models->get($args[ 0 ]); |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
return o2system()->models; |
148
|
|
|
} |
149
|
|
|
} |
150
|
|
|
|
151
|
|
|
// ------------------------------------------------------------------------ |
152
|
|
|
|
153
|
|
|
if ( ! function_exists('router')) { |
154
|
|
|
/** |
155
|
|
|
* router |
156
|
|
|
* |
157
|
|
|
* Convenient shortcut for O2System Framework Router service. |
158
|
|
|
* |
159
|
|
|
* @return O2System\Framework\Http\Router|O2System\Framework\Cli\Router |
|
|
|
|
160
|
|
|
*/ |
161
|
|
|
function router() |
162
|
|
|
{ |
163
|
|
|
return services('router'); |
|
|
|
|
164
|
|
|
} |
165
|
|
|
} |
166
|
|
|
|
167
|
|
|
// ------------------------------------------------------------------------ |
168
|
|
|
|
169
|
|
|
if ( ! function_exists('session')) { |
170
|
|
|
/** |
171
|
|
|
* session |
172
|
|
|
* |
173
|
|
|
* Convenient shortcut for O2System Framework Session service. |
174
|
|
|
* |
175
|
|
|
* @return mixed|O2System\Session |
176
|
|
|
*/ |
177
|
|
|
function session() |
178
|
|
|
{ |
179
|
|
|
$args = func_get_args(); |
180
|
|
|
|
181
|
|
|
if (count($args)) { |
182
|
|
|
if(isset($_SESSION[ $args[0] ])) { |
183
|
|
|
return $_SESSION[ $args[0] ]; |
184
|
|
|
} |
185
|
|
|
|
186
|
|
|
return null; |
187
|
|
|
} |
188
|
|
|
|
189
|
|
|
return services('session'); |
190
|
|
|
} |
191
|
|
|
} |
192
|
|
|
|
193
|
|
|
// ------------------------------------------------------------------------ |
194
|
|
|
|
195
|
|
|
if ( ! function_exists('middleware')) { |
196
|
|
|
/** |
197
|
|
|
* O2System |
198
|
|
|
* |
199
|
|
|
* Convenient shortcut for O2System Framework Http Middleware service. |
200
|
|
|
* |
201
|
|
|
* @return O2System\Framework\Http\Middleware |
|
|
|
|
202
|
|
|
*/ |
203
|
|
|
function middleware() |
204
|
|
|
{ |
205
|
|
|
return services('middleware'); |
|
|
|
|
206
|
|
|
} |
207
|
|
|
} |
208
|
|
|
|
209
|
|
|
// ------------------------------------------------------------------------ |
210
|
|
|
|
211
|
|
|
if ( ! function_exists('controller')) { |
212
|
|
|
/** |
213
|
|
|
* controller |
214
|
|
|
* |
215
|
|
|
* Convenient shortcut for O2System Framework Controller service. |
216
|
|
|
* |
217
|
|
|
* @return O2System\Framework\Http\Controller|bool |
|
|
|
|
218
|
|
|
*/ |
219
|
|
|
function controller() |
220
|
|
|
{ |
221
|
|
|
$args = func_get_args(); |
222
|
|
|
|
223
|
|
|
if (count($args)) { |
224
|
|
|
$controller = services()->get('controller'); |
225
|
|
|
|
226
|
|
|
return call_user_func_array([&$controller, '__call'], $args); |
227
|
|
|
} |
228
|
|
|
|
229
|
|
|
return services('controller'); |
|
|
|
|
230
|
|
|
} |
231
|
|
|
} |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths