o2system /
kernel
| 1 | <?php |
||||
| 2 | /** |
||||
| 3 | * This file is part of the O2System 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(); |
||||
|
0 ignored issues
–
show
|
|||||
| 25 | } elseif (class_exists('O2System\Reactor', false)) { |
||||
| 26 | return O2System\Reactor::getInstance(); |
||||
|
0 ignored issues
–
show
The type
O2System\Reactor was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||
| 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 | |||||
| 54 | return kernel()->services->get($args[ 0 ]); |
||||
| 55 | } |
||||
| 56 | |||||
| 57 | return false; |
||||
| 58 | } |
||||
| 59 | |||||
| 60 | return kernel()->services; |
||||
| 61 | } |
||||
| 62 | } |
||||
| 63 | |||||
| 64 | // ------------------------------------------------------------------------ |
||||
| 65 | |||||
| 66 | if ( ! function_exists('profiler')) { |
||||
| 67 | /** |
||||
| 68 | * profiler |
||||
| 69 | * |
||||
| 70 | * Convenient shortcut for O2System Gear Profiler service. |
||||
| 71 | * |
||||
| 72 | * @return bool|O2System\Gear\Profiler |
||||
| 73 | */ |
||||
| 74 | function profiler() |
||||
| 75 | { |
||||
| 76 | if (services()->has('profiler')) { |
||||
| 77 | return services('profiler'); |
||||
|
0 ignored issues
–
show
|
|||||
| 78 | } |
||||
| 79 | |||||
| 80 | return false; |
||||
| 81 | } |
||||
| 82 | } |
||||
| 83 | |||||
| 84 | // ------------------------------------------------------------------------ |
||||
| 85 | |||||
| 86 | if ( ! function_exists('language')) { |
||||
| 87 | /** |
||||
| 88 | * language |
||||
| 89 | * |
||||
| 90 | * Convenient shortcut for O2System Kernel Language service. |
||||
| 91 | * |
||||
| 92 | * @return O2System\Kernel\Services\Language|O2System\Framework\Services\Language |
||||
|
0 ignored issues
–
show
The type
O2System\Framework\Services\Language was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||||
| 93 | */ |
||||
| 94 | function language() |
||||
| 95 | { |
||||
| 96 | $args = func_get_args(); |
||||
| 97 | |||||
| 98 | if (count($args)) { |
||||
| 99 | if (services()->has('language')) { |
||||
| 100 | $language =& services()->get('language'); |
||||
| 101 | |||||
| 102 | return call_user_func_array([&$language, 'getLine'], $args); |
||||
| 103 | } |
||||
| 104 | |||||
| 105 | return false; |
||||
|
0 ignored issues
–
show
|
|||||
| 106 | } |
||||
| 107 | |||||
| 108 | return services('language'); |
||||
|
0 ignored issues
–
show
|
|||||
| 109 | } |
||||
| 110 | } |
||||
| 111 | |||||
| 112 | // ------------------------------------------------------------------------ |
||||
| 113 | |||||
| 114 | if ( ! function_exists('logger')) { |
||||
| 115 | /** |
||||
| 116 | * logger |
||||
| 117 | * |
||||
| 118 | * Convenient shortcut for O2System Kernel Logger service. |
||||
| 119 | * |
||||
| 120 | * @return O2System\Kernel\Services\Logger |
||||
| 121 | */ |
||||
| 122 | function logger() |
||||
| 123 | { |
||||
| 124 | $args = func_get_args(); |
||||
| 125 | |||||
| 126 | if (count($args)) { |
||||
| 127 | if (services()->has('logger')) { |
||||
| 128 | $logger =& services('logger'); |
||||
| 129 | |||||
| 130 | return call_user_func_array([&$logger, 'log'], $args); |
||||
| 131 | } |
||||
| 132 | |||||
| 133 | return false; |
||||
|
0 ignored issues
–
show
|
|||||
| 134 | } |
||||
| 135 | |||||
| 136 | return services('logger'); |
||||
|
0 ignored issues
–
show
|
|||||
| 137 | } |
||||
| 138 | } |
||||
| 139 | |||||
| 140 | // ------------------------------------------------------------------------ |
||||
| 141 | |||||
| 142 | if ( ! function_exists('shutdown')) { |
||||
| 143 | /** |
||||
| 144 | * shutdown |
||||
| 145 | * |
||||
| 146 | * Convenient shortcut for O2System Kernel Shutdown service. |
||||
| 147 | * |
||||
| 148 | * @return bool|O2System\Kernel\Services\Shutdown |
||||
| 149 | */ |
||||
| 150 | function shutdown() |
||||
| 151 | { |
||||
| 152 | if (services()->has('shutdown')) { |
||||
| 153 | return services('shutdown'); |
||||
|
0 ignored issues
–
show
|
|||||
| 154 | } |
||||
| 155 | |||||
| 156 | return false; |
||||
| 157 | } |
||||
| 158 | } |
||||
| 159 | |||||
| 160 | // ------------------------------------------------------------------------ |
||||
| 161 | |||||
| 162 | if ( ! function_exists('input')) { |
||||
| 163 | /** |
||||
| 164 | * input |
||||
| 165 | * |
||||
| 166 | * Convenient shortcut for O2System Kernel Input Instance |
||||
| 167 | * |
||||
| 168 | * @return bool|O2System\Kernel\Http\Input|O2System\Kernel\Cli\Input |
||||
| 169 | */ |
||||
| 170 | function input() |
||||
| 171 | { |
||||
| 172 | if (services()->has('input')) { |
||||
| 173 | return services('input'); |
||||
|
0 ignored issues
–
show
|
|||||
| 174 | } |
||||
| 175 | |||||
| 176 | return false; |
||||
| 177 | } |
||||
| 178 | } |
||||
| 179 | |||||
| 180 | // ------------------------------------------------------------------------ |
||||
| 181 | |||||
| 182 | if ( ! function_exists('output')) { |
||||
| 183 | /** |
||||
| 184 | * output |
||||
| 185 | * |
||||
| 186 | * Convenient shortcut for O2System Kernel Browser Instance |
||||
| 187 | * |
||||
| 188 | * @return bool|O2System\Kernel\Http\Output|O2System\Kernel\Cli\Output |
||||
| 189 | */ |
||||
| 190 | function output() |
||||
| 191 | { |
||||
| 192 | if (services()->has('output')) { |
||||
| 193 | return services('output'); |
||||
|
0 ignored issues
–
show
|
|||||
| 194 | } |
||||
| 195 | |||||
| 196 | return false; |
||||
| 197 | } |
||||
| 198 | } |
||||
| 199 | |||||
| 200 | // ------------------------------------------------------------------------ |
||||
| 201 | |||||
| 202 | if ( ! function_exists('server_request')) { |
||||
| 203 | /** |
||||
| 204 | * server_request |
||||
| 205 | * |
||||
| 206 | * Convenient shortcut for O2System Kernel Http Message Request service. |
||||
| 207 | * |
||||
| 208 | * @return O2System\Kernel\Http\Message\Request |
||||
| 209 | */ |
||||
| 210 | function server_request() |
||||
| 211 | { |
||||
| 212 | if (services()->has('serverRequest') === false) { |
||||
| 213 | services()->load(new \O2System\Kernel\Http\Message\ServerRequest(), 'serverRequest'); |
||||
|
0 ignored issues
–
show
new O2System\Kernel\Http\Message\ServerRequest() of type O2System\Kernel\Http\Message\ServerRequest is incompatible with the type string expected by parameter $className of O2System\Kernel\Containers\Services::load().
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 214 | } |
||||
| 215 | |||||
| 216 | return services('serverRequest'); |
||||
|
0 ignored issues
–
show
|
|||||
| 217 | } |
||||
| 218 | } |
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