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.

profiler()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
nc 2
nop 0
dl 0
loc 7
rs 10
c 3
b 0
f 0
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
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
        } elseif (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
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
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|boolean.
Loading history...
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
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...
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
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...
106
        }
107
108
        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...
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
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...
134
        }
135
136
        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...
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
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|boolean.
Loading history...
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
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...rnel\Http\Input|boolean.
Loading history...
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
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...nel\Http\Output|boolean.
Loading history...
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
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 $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 ignore-type  annotation

213
            services()->load(/** @scrutinizer ignore-type */ new \O2System\Kernel\Http\Message\ServerRequest(), 'serverRequest');
Loading history...
214
        }
215
216
        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...
217
    }
218
}