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 ( 9c3470...c852c0 )
by
unknown
02:52
created

services()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
nc 2
nop 0
dl 0
loc 9
rs 10
c 1
b 0
f 0
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\Framework
20
     */
21
    function o2system()
22
    {
23
        return O2System\Framework::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 O2System\Framework\Services\Loader
36
     */
37
    function loader()
38
    {
39
        return services('loader');
0 ignored issues
show
Bug introduced by
The function services was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

39
        return /** @scrutinizer ignore-call */ services('loader');
Loading history...
40
    }
41
}
42
43
// ------------------------------------------------------------------------
44
45
if ( ! function_exists('config')) {
46
    /**
47
     * config
48
     *
49
     * Convenient shortcut for O2System Framework Config service.
50
     *
51
     * @return O2System\Framework\Services\Config|\O2System\Kernel\Datastructures\Config
52
     */
53
    function config()
54
    {
55
        $args = func_get_args();
56
57
        if ($countArgs = count($args)) {
58
            if(services()->has('config')) {
0 ignored issues
show
Bug introduced by
The function services was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

58
            if(/** @scrutinizer ignore-call */ services()->has('config')) {
Loading history...
59
                $config = services('config');
60
61
                if ($countArgs == 1) {
62
                    return call_user_func_array([&$config, 'getItem'], $args);
63
                } else {
64
                    return call_user_func_array([&$config, 'loadFile'], $args);
65
                }
66
            }
67
        }
68
69
        return services('config');
70
    }
71
}
72
73
// ------------------------------------------------------------------------
74
75
if ( ! function_exists('cache')) {
76
    /**
77
     * cache
78
     *
79
     * Convenient shortcut for O2System Framework Cache service.
80
     *
81
     * @return O2System\Framework\Services\Cache|boolean Returns FALSE if service not exists.
82
     */
83
    function cache()
84
    {
85
        if(services()->has('cache')) {
0 ignored issues
show
Bug introduced by
The function services was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

85
        if(/** @scrutinizer ignore-call */ services()->has('cache')) {
Loading history...
86
            return services()->get('cache');
87
        }
88
89
        return false;
90
    }
91
}
92
93
// ------------------------------------------------------------------------
94
95
if ( ! function_exists('hooks')) {
96
    /**
97
     * hooks
98
     *
99
     * Convenient shortcut for O2System Framework Hooks service.
100
     *
101
     * @return O2System\Framework\Services\Hooks Returns FALSE if service not exists.
102
     */
103
    function hooks()
104
    {
105
        if(services()->has('hooks')) {
0 ignored issues
show
Bug introduced by
The function services was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

105
        if(/** @scrutinizer ignore-call */ services()->has('hooks')) {
Loading history...
106
            return services()->get('hooks');
107
        }
108
109
        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\Services\Hooks.
Loading history...
110
    }
111
}
112
113
// ------------------------------------------------------------------------
114
115
if ( ! function_exists('database')) {
116
    /**
117
     * database
118
     *
119
     * Convenient shortcut for O2System Framework Database Connection pools.
120
     *
121
     * @return O2System\Database\Connections
122
     */
123
    function database()
124
    {
125
        return models()->database;
0 ignored issues
show
Bug Best Practice introduced by
The property database does not exist on O2System\Framework\Models\NoSql\Model. Since you implemented __get, consider adding a @property annotation.
Loading history...
Bug Best Practice introduced by
The expression return models()->database could also return false which is incompatible with the documented return type O2System\Database\Connections. Did you maybe forget to handle an error condition?

If the returned type also contains false, it is an indicator that maybe an error condition leading to the specific return statement remains unhandled.

Loading history...
Bug Best Practice introduced by
The property database does not exist on O2System\Framework\Models\Sql\Model. Since you implemented __get, consider adding a @property annotation.
Loading history...
126
    }
127
}
128
129
// ------------------------------------------------------------------------
130
131
if ( ! function_exists('models')) {
132
    /**
133
     * models
134
     *
135
     * Convenient shortcut for O2System Framework Models container.
136
     *
137
     * @return O2System\Framework\Containers\Models|O2System\Framework\Models\Sql\Model|O2System\Framework\Models\NoSql\Model
138
     */
139
    function models()
140
    {
141
        $args = func_get_args();
142
143
        if (count($args)) {
144
            return o2system()->models->get($args[ 0 ]);
145
        }
146
147
        return o2system()->models;
148
    }
149
}
150
151
// ------------------------------------------------------------------------
152
153
if ( ! function_exists('modules')) {
154
    /**
155
     * modules
156
     *
157
     * Convenient shortcut for O2System Framework Modules container.
158
     *
159
     * @return O2System\Framework\Containers\Modules
160
     */
161
    function modules()
162
    {
163
        $args = func_get_args();
164
165
        if (count($args)) {
166
            return o2system()->modules->getModule($args[ 0 ]);
0 ignored issues
show
Bug Best Practice introduced by
The expression return o2system()->modules->getModule($args[0]) returns the type O2System\Framework\Datastructures\Module|boolean which is incompatible with the documented return type O2System\Framework\Containers\Modules.
Loading history...
167
        }
168
169
        return o2system()->modules;
170
    }
171
}
172
173
// ------------------------------------------------------------------------
174
175
if ( ! function_exists('router')) {
176
    /**
177
     * router
178
     *
179
     * Convenient shortcut for O2System Framework Router service.
180
     *
181
     * @return O2System\Framework\Http\Router|O2System\Framework\Cli\Router
0 ignored issues
show
Bug introduced by
The type O2System\Framework\Cli\Router 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...
182
     */
183
    function router()
184
    {
185
        return services('router');
0 ignored issues
show
Bug introduced by
The function services was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

185
        return /** @scrutinizer ignore-call */ services('router');
Loading history...
186
    }
187
}
188
189
// ------------------------------------------------------------------------
190
191
if ( ! function_exists('session')) {
192
    /**
193
     * session
194
     *
195
     * Convenient shortcut for O2System Framework Session service.
196
     *
197
     * @return mixed|O2System\Session
198
     */
199
    function session()
200
    {
201
        $args = func_get_args();
202
203
        if (count($args)) {
204
            if(isset($_SESSION[ $args[0] ])) {
205
                return $_SESSION[ $args[0] ];
206
            }
207
208
            return null;
209
        }
210
211
        return services('session');
0 ignored issues
show
Bug introduced by
The function services was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

211
        return /** @scrutinizer ignore-call */ services('session');
Loading history...
212
    }
213
}
214
215
// ------------------------------------------------------------------------
216
217
if ( ! function_exists('middleware')) {
218
    /**
219
     * O2System
220
     *
221
     * Convenient shortcut for O2System Framework Http Middleware service.
222
     *
223
     * @return O2System\Framework\Http\Middleware
224
     */
225
    function middleware()
226
    {
227
        return services('middleware');
0 ignored issues
show
Bug introduced by
The function services was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

227
        return /** @scrutinizer ignore-call */ services('middleware');
Loading history...
228
    }
229
}
230
231
// ------------------------------------------------------------------------
232
233
if ( ! function_exists('view')) {
234
    /**
235
     * view
236
     *
237
     * Convenient shortcut for O2System Framework View service.
238
     *
239
     * @return O2System\Framework\Http\View|string
240
     */
241
    function view()
242
    {
243
        $args = func_get_args();
244
245
        if (count($args)) {
246
            if(services()->has('view')) {
0 ignored issues
show
Bug introduced by
The function services was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

246
            if(/** @scrutinizer ignore-call */ services()->has('view')) {
Loading history...
247
                $view = services('view');
248
249
                return call_user_func_array([&$view, 'load'], $args);
250
            }
251
252
            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\Http\View|string.
Loading history...
253
        }
254
255
        return services('view');
256
    }
257
}
258
259
// ------------------------------------------------------------------------
260
261
if ( ! function_exists('parser')) {
262
    /**
263
     * parser
264
     *
265
     * Convenient shortcut for O2System Parser service.
266
     *
267
     * @return O2System\Framework\Http\Parser
268
     */
269
    function parser()
270
    {
271
        return services('parser');
0 ignored issues
show
Bug introduced by
The function services was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

271
        return /** @scrutinizer ignore-call */ services('parser');
Loading history...
272
    }
273
}
274
275
// ------------------------------------------------------------------------
276
277
if ( ! function_exists('presenter')) {
278
    /**
279
     * presenter
280
     *
281
     * Convenient shortcut for O2System Framework Http Presenter service.
282
     *
283
     * @return O2System\Framework\Http\Presenter|object
284
     */
285
    function presenter()
286
    {
287
        return services('presenter');
0 ignored issues
show
Bug introduced by
The function services was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

287
        return /** @scrutinizer ignore-call */ services('presenter');
Loading history...
288
    }
289
}
290
291
// ------------------------------------------------------------------------
292
293
if ( ! function_exists('controller')) {
294
    /**
295
     * controller
296
     *
297
     * Convenient shortcut for O2System Framework Controller service.
298
     *
299
     * @return O2System\Framework\Http\Controller|bool
300
     */
301
    function controller()
302
    {
303
        $args = func_get_args();
304
305
        if (count($args)) {
306
            $controller = services()->get('controller');
0 ignored issues
show
Bug introduced by
The function services was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

306
            $controller = /** @scrutinizer ignore-call */ services()->get('controller');
Loading history...
307
308
            return call_user_func_array([&$controller, '__call'], $args);
309
        }
310
311
        return services('controller');
312
    }
313
}