GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( 7faace...f28312 )
by
unknown
01:50
created

globals()   A

Complexity

Conditions 5
Paths 5

Size

Total Lines 19
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
cc 5
eloc 9
c 3
b 0
f 0
nc 5
nop 1
dl 0
loc 19
rs 9.6111
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();
0 ignored issues
show
Bug introduced by
The type O2System\Framework 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
25
        } else if (class_exists('O2System\Reactor', false)) {
26
            return O2System\Reactor::getInstance();
0 ignored issues
show
Bug introduced by
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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

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
                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');
0 ignored issues
show
Bug Best Practice introduced by
The expression return services('profiler') also could return the type O2System\Kernel\Containers\Services which is incompatible with the documented return type O2System\Gear\Profiler.
Loading history...
76
    }
77
}
78
79
if (!function_exists('globals')) {
80
    /**
81
     * globals
82
     *
83
     * Convenient shortcut for O2System Kernel Globals container.
84
     *
85
     * @param string $offset
86
     *
87
     * @return O2System\Kernel\Containers\Globals
88
     */
89
    function globals($offset = null)
90
    {
91
        $args = func_get_args();
92
93
        if (count($args)) {
94
            if (isset($args[0])) {
95
                if (isset($GLOBALS[$args[0]])) {
96
                    return $GLOBALS[$args[0]];
97
                }
98
            }
99
100
            return null;
101
        }
102
103
        if ( ! services()->has('globals')) {
104
            services()->load(new \O2System\Kernel\Containers\Globals(), 'globals');
0 ignored issues
show
Bug introduced by
new O2System\Kernel\Containers\Globals() of type O2System\Kernel\Containers\Globals is incompatible with the type string expected by parameter $service 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 ignore-type  annotation

104
            services()->load(/** @scrutinizer ignore-type */ new \O2System\Kernel\Containers\Globals(), 'globals');
Loading history...
105
        }
106
107
        return services('globals');
0 ignored issues
show
Bug Best Practice introduced by
The expression return services('globals') also could return the type O2System\Kernel\Containers\Services which is incompatible with the documented return type O2System\Kernel\Containers\Globals.
Loading history...
108
    }
109
}
110
111
// ------------------------------------------------------------------------
112
113
if (!function_exists('env')) {
114
    /**
115
     * env
116
     *
117
     * Convenient shortcut for O2System Kernel Environment container.
118
     *
119
     * @param string $offset
120
     *
121
     * @return O2System\Kernel\Containers\Globals
122
     */
123
    function env($offset = null)
124
    {
125
        $args = func_get_args();
126
127
        if (count($args)) {
128
            if (isset($args[0])) {
129
                if (isset($_ENV[$args[0]])) {
130
                    return $_ENV[$args[0]];
131
                }
132
            }
133
134
            return null;
135
        }
136
137
        if ( ! services()->has('environment')) {
138
            services()->load(new \O2System\Kernel\Containers\Environment(), 'environment');
0 ignored issues
show
Bug introduced by
new O2System\Kernel\Containers\Environment() of type O2System\Kernel\Containers\Environment is incompatible with the type string expected by parameter $service 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 ignore-type  annotation

138
            services()->load(/** @scrutinizer ignore-type */ new \O2System\Kernel\Containers\Environment(), 'environment');
Loading history...
139
        }
140
141
        return services('environment');
0 ignored issues
show
Bug Best Practice introduced by
The expression return services('environment') also could return the type O2System\Kernel\Containers\Services which is incompatible with the documented return type O2System\Kernel\Containers\Globals.
Loading history...
142
    }
143
}
144
145
// ------------------------------------------------------------------------
146
147
if (!function_exists('language')) {
148
    /**
149
     * language
150
     *
151
     * Convenient shortcut for O2System Kernel Language service.
152
     *
153
     * @return O2System\Kernel\Services\Language|O2System\Framework\Services\Language
0 ignored issues
show
Bug introduced by
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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
154
     */
155
    function language()
156
    {
157
        $args = func_get_args();
158
159
        if (count($args)) {
160
            if (services()->has('language')) {
161
                $language =& kernel()->services->get('language');
162
163
                return call_user_func_array([&$language, 'getLine'], $args);
164
            }
165
166
            return false;
0 ignored issues
show
Bug Best Practice introduced by
The expression return false returns the type false which is incompatible with the documented return type O2System\Framework\Servi...ernel\Services\Language.
Loading history...
167
        }
168
169
        return services('language');
0 ignored issues
show
Bug Best Practice introduced by
The expression return services('language') also could return the type O2System\Kernel\Containers\Services which is incompatible with the documented return type O2System\Framework\Servi...ernel\Services\Language.
Loading history...
170
    }
171
}
172
173
// ------------------------------------------------------------------------
174
175
if (!function_exists('logger')) {
176
    /**
177
     * logger
178
     *
179
     * Convenient shortcut for O2System Kernel Logger service.
180
     *
181
     * @return O2System\Kernel\Services\Logger
182
     */
183
    function logger()
184
    {
185
        $args = func_get_args();
186
187
        if (count($args)) {
188
            if (services()->has('logger')) {
189
                $logger =& services('logger');
190
191
                return call_user_func_array([&$logger, 'log'], $args);
192
            }
193
194
            return false;
0 ignored issues
show
Bug Best Practice introduced by
The expression return false returns the type false which is incompatible with the documented return type O2System\Kernel\Services\Logger.
Loading history...
195
        }
196
197
        return services('logger');
0 ignored issues
show
Bug Best Practice introduced by
The expression return services('logger') also could return the type O2System\Kernel\Containers\Services which is incompatible with the documented return type O2System\Kernel\Services\Logger.
Loading history...
198
    }
199
}
200
201
// ------------------------------------------------------------------------
202
203
if (!function_exists('shutdown')) {
204
    /**
205
     * shutdown
206
     *
207
     * Convenient shortcut for O2System Kernel Shutdown service.
208
     *
209
     * @return O2System\Kernel\Services\Shutdown
210
     */
211
    function shutdown()
212
    {
213
        return services('shutdown');
0 ignored issues
show
Bug Best Practice introduced by
The expression return services('shutdown') also could return the type O2System\Kernel\Containers\Services which is incompatible with the documented return type O2System\Kernel\Services\Shutdown.
Loading history...
214
    }
215
}
216
217
// ------------------------------------------------------------------------
218
219
if (!function_exists('input')) {
220
    /**
221
     * input
222
     *
223
     * Convenient shortcut for O2System Kernel Input Instance
224
     *
225
     * @return O2System\Kernel\Http\Input|O2System\Kernel\Cli\Input
226
     */
227
    function input()
228
    {
229
        return services('input');
0 ignored issues
show
Bug Best Practice introduced by
The expression return services('input') also could return the type O2System\Kernel\Containers\Services which is incompatible with the documented return type O2System\Kernel\Cli\Inpu...ystem\Kernel\Http\Input.
Loading history...
230
    }
231
}
232
233
// ------------------------------------------------------------------------
234
235
if (!function_exists('output')) {
236
    /**
237
     * output
238
     *
239
     * Convenient shortcut for O2System Kernel Browser Instance
240
     *
241
     * @return O2System\Kernel\Http\Output|O2System\Kernel\Cli\Output
242
     */
243
    function output()
244
    {
245
        return services('output');
0 ignored issues
show
Bug Best Practice introduced by
The expression return services('output') also could return the type O2System\Kernel\Containers\Services which is incompatible with the documented return type O2System\Kernel\Cli\Outp...stem\Kernel\Http\Output.
Loading history...
246
    }
247
}
248
249
// ------------------------------------------------------------------------
250
251
if (!function_exists('server_request')) {
252
    /**
253
     * server_request
254
     *
255
     * Convenient shortcut for O2System Kernel Http Message Request service.
256
     *
257
     * @return O2System\Kernel\Http\Message\Request
258
     */
259
    function server_request()
260
    {
261
        if (function_exists('o2system')) {
262
            if (!services()->has('serverRequest')) {
263
                services()->load(new \O2System\Kernel\Http\Message\ServerRequest(), 'serverRequest');
0 ignored issues
show
Bug introduced by
new O2System\Kernel\Http\Message\ServerRequest() of type O2System\Kernel\Http\Message\ServerRequest is incompatible with the type string expected by parameter $service 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 ignore-type  annotation

263
                services()->load(/** @scrutinizer ignore-type */ new \O2System\Kernel\Http\Message\ServerRequest(), 'serverRequest');
Loading history...
264
            }
265
266
            return services('serverRequest');
0 ignored issues
show
Bug Best Practice introduced by
The expression return services('serverRequest') also could return the type O2System\Kernel\Containers\Services which is incompatible with the documented return type O2System\Kernel\Http\Message\Request.
Loading history...
267
        } else {
268
            if (!services()->has('serverRequest')) {
269
                services()->load(new \O2System\Kernel\Http\Message\ServerRequest(), 'serverRequest');
270
            }
271
272
            return services('serverRequest');
0 ignored issues
show
Bug Best Practice introduced by
The expression return services('serverRequest') also could return the type O2System\Kernel\Containers\Services which is incompatible with the documented return type O2System\Kernel\Http\Message\Request.
Loading history...
273
        }
274
    }
275
}
276