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\Reactor |
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 bool|O2System\Framework\Services\Loader |
|
|
|
|
36
|
|
|
*/ |
37
|
|
|
function loader() |
38
|
|
|
{ |
39
|
|
|
if(services()->has('loader')) { |
40
|
|
|
return services()->get('loader'); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
return false; |
44
|
|
|
} |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
// ------------------------------------------------------------------------ |
48
|
|
|
|
49
|
|
|
if ( ! function_exists('config')) { |
50
|
|
|
/** |
51
|
|
|
* config |
52
|
|
|
* |
53
|
|
|
* Convenient shortcut for O2System Framework Config service. |
54
|
|
|
* |
55
|
|
|
* @return O2System\Reactor\Containers\Config|\O2System\Kernel\Datastructures\Config |
56
|
|
|
*/ |
57
|
|
|
function config() |
58
|
|
|
{ |
59
|
|
|
$args = func_get_args(); |
60
|
|
|
|
61
|
|
|
if ($numArgs = count($args)) { |
62
|
|
|
$config = o2system()->config; |
63
|
|
|
|
64
|
|
|
if($numArgs == 1) { |
65
|
|
|
return call_user_func_array([&$config, 'getItem'], $args); |
66
|
|
|
} else { |
67
|
|
|
return call_user_func_array([&$config, 'loadFile'], $args); |
68
|
|
|
} |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
return o2system()->config; |
72
|
|
|
} |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
// ------------------------------------------------------------------------ |
76
|
|
|
|
77
|
|
|
if ( ! function_exists('cache')) { |
78
|
|
|
/** |
79
|
|
|
* cache |
80
|
|
|
* |
81
|
|
|
* Convenient shortcut for O2System Framework Cache service. |
82
|
|
|
* |
83
|
|
|
* @return O2System\Framework\Services\Cache|boolean Returns FALSE if service not exists. |
|
|
|
|
84
|
|
|
*/ |
85
|
|
|
function cache() |
86
|
|
|
{ |
87
|
|
|
if(services()->has('cache')) { |
88
|
|
|
return services()->get('cache'); |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
return false; |
92
|
|
|
} |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
// ------------------------------------------------------------------------ |
96
|
|
|
|
97
|
|
|
if ( ! function_exists('database')) { |
98
|
|
|
/** |
99
|
|
|
* database |
100
|
|
|
* |
101
|
|
|
* Convenient shortcut for O2System Framework Database Connection pools. |
102
|
|
|
* |
103
|
|
|
* @return O2System\Database\Connections |
104
|
|
|
*/ |
105
|
|
|
function database() |
106
|
|
|
{ |
107
|
|
|
return models()->database; |
108
|
|
|
} |
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
// ------------------------------------------------------------------------ |
112
|
|
|
|
113
|
|
|
if ( ! function_exists('models')) { |
114
|
|
|
/** |
115
|
|
|
* models |
116
|
|
|
* |
117
|
|
|
* Convenient shortcut for O2System Framework Models container. |
118
|
|
|
* |
119
|
|
|
* @return O2System\Framework\Containers\Models|O2System\Framework\Models\Sql\Model|O2System\Framework\Models\NoSql\Model |
|
|
|
|
120
|
|
|
*/ |
121
|
|
|
function models() |
122
|
|
|
{ |
123
|
|
|
$args = func_get_args(); |
124
|
|
|
|
125
|
|
|
if (count($args)) { |
126
|
|
|
return o2system()->models->get($args[ 0 ]); |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
return o2system()->models; |
|
|
|
|
130
|
|
|
} |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
// ------------------------------------------------------------------------ |
134
|
|
|
|
135
|
|
|
if ( ! function_exists('router')) { |
136
|
|
|
/** |
137
|
|
|
* router |
138
|
|
|
* |
139
|
|
|
* Convenient shortcut for O2System Framework Router service. |
140
|
|
|
* |
141
|
|
|
* @return bool|O2System\Framework\Http\Router|O2System\Framework\Cli\Router |
|
|
|
|
142
|
|
|
*/ |
143
|
|
|
function router() |
144
|
|
|
{ |
145
|
|
|
if(services()->has('router')) { |
146
|
|
|
return services()->get('router'); |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
return false; |
150
|
|
|
} |
151
|
|
|
} |
152
|
|
|
|
153
|
|
|
// ------------------------------------------------------------------------ |
154
|
|
|
|
155
|
|
|
if ( ! function_exists('session')) { |
156
|
|
|
/** |
157
|
|
|
* session |
158
|
|
|
* |
159
|
|
|
* Convenient shortcut for O2System Framework Session service. |
160
|
|
|
* |
161
|
|
|
* @return mixed|O2System\Session |
162
|
|
|
*/ |
163
|
|
|
function session() |
164
|
|
|
{ |
165
|
|
|
$args = func_get_args(); |
166
|
|
|
|
167
|
|
|
if (count($args)) { |
168
|
|
|
if(isset($_SESSION[ $args[0] ])) { |
169
|
|
|
return $_SESSION[ $args[0] ]; |
170
|
|
|
} |
171
|
|
|
|
172
|
|
|
return null; |
173
|
|
|
} |
174
|
|
|
|
175
|
|
|
return services('session'); |
176
|
|
|
} |
177
|
|
|
} |
178
|
|
|
|
179
|
|
|
// ------------------------------------------------------------------------ |
180
|
|
|
|
181
|
|
|
if ( ! function_exists('middleware')) { |
182
|
|
|
/** |
183
|
|
|
* O2System |
184
|
|
|
* |
185
|
|
|
* Convenient shortcut for O2System Framework Http Middleware service. |
186
|
|
|
* |
187
|
|
|
* @return bool|O2System\Framework\Http\Middleware |
|
|
|
|
188
|
|
|
*/ |
189
|
|
|
function middleware() |
190
|
|
|
{ |
191
|
|
|
if(services()->has('middleware')) { |
192
|
|
|
return services()->get('middleware'); |
193
|
|
|
} |
194
|
|
|
|
195
|
|
|
return false; |
196
|
|
|
} |
197
|
|
|
} |
198
|
|
|
|
199
|
|
|
// ------------------------------------------------------------------------ |
200
|
|
|
|
201
|
|
|
if ( ! function_exists('controller')) { |
202
|
|
|
/** |
203
|
|
|
* controller |
204
|
|
|
* |
205
|
|
|
* Convenient shortcut for O2System Framework Controller service. |
206
|
|
|
* |
207
|
|
|
* @return O2System\Framework\Http\Controller|bool |
|
|
|
|
208
|
|
|
*/ |
209
|
|
|
function controller() |
210
|
|
|
{ |
211
|
|
|
if(services()->has('controller')) { |
212
|
|
|
$args = func_get_args(); |
213
|
|
|
|
214
|
|
|
if (count($args)) { |
215
|
|
|
$controller = services()->get('controller'); |
216
|
|
|
|
217
|
|
|
return call_user_func_array([&$controller, '__call'], $args); |
218
|
|
|
} |
219
|
|
|
|
220
|
|
|
return services('controller'); |
|
|
|
|
221
|
|
|
} |
222
|
|
|
|
223
|
|
|
return false; |
224
|
|
|
} |
225
|
|
|
} |
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