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('kernel')) { |
14
|
|
|
/** |
15
|
|
|
* kernel |
16
|
|
|
* |
17
|
|
|
* Convenient shortcut for O2System Kernel Instance |
18
|
|
|
* |
19
|
|
|
* @return O2System\Kernel |
20
|
|
|
*/ |
21
|
|
|
function kernel() |
22
|
|
|
{ |
23
|
|
|
if (class_exists('O2System\Framework', false)) { |
24
|
|
|
return O2System\Framework::getInstance(); |
|
|
|
|
25
|
|
|
} else if (class_exists('O2System\Reactor', false)) { |
26
|
|
|
return O2System\Reactor::getInstance(); |
|
|
|
|
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
return O2System\Kernel::getInstance(); |
30
|
|
|
} |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
// ------------------------------------------------------------------------ |
34
|
|
|
|
35
|
|
|
|
36
|
|
|
if (!function_exists('services')) { |
37
|
|
|
/** |
38
|
|
|
* services |
39
|
|
|
* |
40
|
|
|
* Convenient shortcut for O2System Framework Services container. |
41
|
|
|
* |
42
|
|
|
* @return mixed|\O2System\Kernel\Containers\Services |
43
|
|
|
*/ |
44
|
|
|
function services() |
45
|
|
|
{ |
46
|
|
|
$args = func_get_args(); |
47
|
|
|
|
48
|
|
|
if (count($args)) { |
49
|
|
|
if (kernel()->services->has($args[0])) { |
50
|
|
|
if(isset($args[1]) and is_array($args[1])) { |
51
|
|
|
return kernel()->services->get($args[0], $args[1]); |
52
|
|
|
} |
53
|
|
|
return kernel()->services->get($args[0]); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
return false; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
return kernel()->services; |
60
|
|
|
} |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
// ------------------------------------------------------------------------ |
64
|
|
|
|
65
|
|
|
if (!function_exists('profiler')) { |
66
|
|
|
/** |
67
|
|
|
* profiler |
68
|
|
|
* |
69
|
|
|
* Convenient shortcut for O2System Gear Profiler service. |
70
|
|
|
* |
71
|
|
|
* @return O2System\Gear\Profiler |
72
|
|
|
*/ |
73
|
|
|
function profiler() |
74
|
|
|
{ |
75
|
|
|
return services('profiler'); |
|
|
|
|
76
|
|
|
} |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
// ------------------------------------------------------------------------ |
80
|
|
|
|
81
|
|
|
if (!function_exists('language')) { |
82
|
|
|
/** |
83
|
|
|
* language |
84
|
|
|
* |
85
|
|
|
* Convenient shortcut for O2System Kernel Language service. |
86
|
|
|
* |
87
|
|
|
* @return O2System\Kernel\Services\Language|O2System\Framework\Services\Language |
|
|
|
|
88
|
|
|
*/ |
89
|
|
|
function language() |
90
|
|
|
{ |
91
|
|
|
$args = func_get_args(); |
92
|
|
|
|
93
|
|
|
if (count($args)) { |
94
|
|
|
if (services()->has('language')) { |
95
|
|
|
$language =& kernel()->services->get('language'); |
96
|
|
|
|
97
|
|
|
return call_user_func_array([&$language, 'getLine'], $args); |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
return false; |
|
|
|
|
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
return services('language'); |
|
|
|
|
104
|
|
|
} |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
// ------------------------------------------------------------------------ |
108
|
|
|
|
109
|
|
|
if (!function_exists('logger')) { |
110
|
|
|
/** |
111
|
|
|
* logger |
112
|
|
|
* |
113
|
|
|
* Convenient shortcut for O2System Kernel Logger service. |
114
|
|
|
* |
115
|
|
|
* @return O2System\Kernel\Services\Logger |
116
|
|
|
*/ |
117
|
|
|
function logger() |
118
|
|
|
{ |
119
|
|
|
$args = func_get_args(); |
120
|
|
|
|
121
|
|
|
if (count($args)) { |
122
|
|
|
if (services()->has('logger')) { |
123
|
|
|
$logger =& services('logger'); |
124
|
|
|
|
125
|
|
|
return call_user_func_array([&$logger, 'log'], $args); |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
return false; |
|
|
|
|
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
return services('logger'); |
|
|
|
|
132
|
|
|
} |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
// ------------------------------------------------------------------------ |
136
|
|
|
|
137
|
|
|
if (!function_exists('shutdown')) { |
138
|
|
|
/** |
139
|
|
|
* shutdown |
140
|
|
|
* |
141
|
|
|
* Convenient shortcut for O2System Kernel Shutdown service. |
142
|
|
|
* |
143
|
|
|
* @return O2System\Kernel\Services\Shutdown |
144
|
|
|
*/ |
145
|
|
|
function shutdown() |
146
|
|
|
{ |
147
|
|
|
return services('shutdown'); |
|
|
|
|
148
|
|
|
} |
149
|
|
|
} |
150
|
|
|
|
151
|
|
|
// ------------------------------------------------------------------------ |
152
|
|
|
|
153
|
|
|
if (!function_exists('input')) { |
154
|
|
|
/** |
155
|
|
|
* input |
156
|
|
|
* |
157
|
|
|
* Convenient shortcut for O2System Kernel Input Instance |
158
|
|
|
* |
159
|
|
|
* @return O2System\Kernel\Http\Input|O2System\Kernel\Cli\Input |
160
|
|
|
*/ |
161
|
|
|
function input() |
162
|
|
|
{ |
163
|
|
|
return services('input'); |
|
|
|
|
164
|
|
|
} |
165
|
|
|
} |
166
|
|
|
|
167
|
|
|
// ------------------------------------------------------------------------ |
168
|
|
|
|
169
|
|
|
if (!function_exists('output')) { |
170
|
|
|
/** |
171
|
|
|
* output |
172
|
|
|
* |
173
|
|
|
* Convenient shortcut for O2System Kernel Browser Instance |
174
|
|
|
* |
175
|
|
|
* @return O2System\Kernel\Http\Output|O2System\Kernel\Cli\Output |
176
|
|
|
*/ |
177
|
|
|
function output() |
178
|
|
|
{ |
179
|
|
|
return services('output'); |
|
|
|
|
180
|
|
|
} |
181
|
|
|
} |
182
|
|
|
|
183
|
|
|
// ------------------------------------------------------------------------ |
184
|
|
|
|
185
|
|
|
if (!function_exists('server_request')) { |
186
|
|
|
/** |
187
|
|
|
* server_request |
188
|
|
|
* |
189
|
|
|
* Convenient shortcut for O2System Kernel Http Message Request service. |
190
|
|
|
* |
191
|
|
|
* @return O2System\Kernel\Http\Message\Request |
192
|
|
|
*/ |
193
|
|
|
function server_request() |
194
|
|
|
{ |
195
|
|
|
if (function_exists('o2system')) { |
196
|
|
|
if (!services()->has('serverRequest')) { |
197
|
|
|
services()->load(new \O2System\Kernel\Http\Message\ServerRequest(), 'serverRequest'); |
|
|
|
|
198
|
|
|
} |
199
|
|
|
|
200
|
|
|
return services('serverRequest'); |
|
|
|
|
201
|
|
|
} else { |
202
|
|
|
if (!services()->has('serverRequest')) { |
203
|
|
|
services()->load(new \O2System\Kernel\Http\Message\ServerRequest(), 'serverRequest'); |
204
|
|
|
} |
205
|
|
|
|
206
|
|
|
return services('serverRequest'); |
|
|
|
|
207
|
|
|
} |
208
|
|
|
} |
209
|
|
|
} |
210
|
|
|
|
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