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.

Issues (558)

src/Containers/Models.php (6 issues)

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
14
namespace O2System\Reactor\Containers;
15
16
// ------------------------------------------------------------------------
17
18
use O2System\Database;
19
use O2System\Spl\Containers\DataStructures\SplServiceRegistry;
20
use O2System\Spl\Containers\SplServiceContainer;
21
22
/**
23
 * Class Models
24
 *
25
 * @package O2System\Reactor\Containers
26
 */
27
class Models extends SplServiceContainer
28
{
29
    /**
30
     * Models::$database
31
     *
32
     * @var \O2System\Database\Connections
33
     */
34
    public $database;
35
36
    // ------------------------------------------------------------------------
37
38
    /**
39
     * Models::__construct
40
     */
41
    public function __construct()
42
    {
43
        if ($config = config()->loadFile('database', true)) {
0 ignored issues
show
The method loadFile() does not exist on O2System\Kernel\DataStructures\Config. ( Ignorable by Annotation )

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

43
        if ($config = config()->/** @scrutinizer ignore-call */ loadFile('database', true)) {

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
44
            if ( ! empty($config[ 'default' ][ 'hostname' ]) AND ! empty($config[ 'default' ][ 'username' ])) {
45
46
                if (profiler() !== false) {
47
                    profiler()->watch('Starting Database Service');
48
                }
49
50
                $this->database = new Database\Connections(
51
                    new Database\DataStructures\Config(
52
                        $config->getArrayCopy()
53
                    )
54
                );
55
            }
56
        }
57
    }
58
59
    // ------------------------------------------------------------------------
60
61
    /**
62
     * Models::load
63
     *
64
     * @param object|string $model
65
     * @param string|null   $offset
66
     */
67
    public function load($model, $offset = null)
68
    {
69
        if (is_string($model)) {
70
            $service = new SplServiceRegistry($model);
71
        } elseif ($model instanceof SplServiceRegistry) {
72
            $service = $model;
73
        }
74
75
        if (isset($service) && $service instanceof SplServiceRegistry) {
76
            if (profiler() !== false) {
77
                profiler()->watch('Load New Model: ' . $service->getClassName());
78
            }
79
80
            $this->register($service, $offset);
81
        }
82
    }
83
84
    // ------------------------------------------------------------------------
85
86
    /**
87
     * Models::register
88
     *
89
     * @param SplServiceRegistry $service
90
     * @param string|null        $offset
91
     */
92
    public function register(SplServiceRegistry $service, $offset = null)
93
    {
94
        if ($service instanceof SplServiceRegistry) {
0 ignored issues
show
$service is always a sub-type of O2System\Spl\Containers\...ures\SplServiceRegistry.
Loading history...
95
            $offset = isset($offset)
96
                ? $offset
97
                : camelcase($service->getParameter());
98
99
            if ($service->isSubclassOf('O2System\Framework\Models\Sql\Model') ||
100
                $service->isSubclassOf('O2System\Framework\Models\NoSql\Model') ||
101
                $service->isSubclassOf('O2System\Framework\Models\Files\Model')
102
            ) {
103
                $this->attach($offset, $service);
104
105
                if (profiler() !== false) {
106
                    profiler()->watch('Register New Model: ' . $service->getClassName());
107
                }
108
            }
109
        }
110
    }
111
112
    // ------------------------------------------------------------------------
113
114
    /**
115
     * Models::add
116
     *
117
     * @param \O2System\Framework\Models\Sql\Model|\O2System\Framework\Models\NoSql\Model|\O2System\Framework\Models\Files\Model $model
0 ignored issues
show
The type O2System\Framework\Models\Files\Model 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...
The type O2System\Framework\Models\NoSql\Model 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...
The type O2System\Framework\Models\Sql\Model 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...
118
     * @param null                                                                                                               $offset
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $offset is correct as it would always require null to be passed?
Loading history...
119
     */
120
    public function add($model, $offset = null)
121
    {
122
        if (is_object($model)) {
123
            if ( ! $model instanceof SplServiceRegistry) {
124
                $model = new SplServiceRegistry($model);
125
            }
126
        }
127
128
        if (profiler() !== false) {
129
            profiler()->watch('Add New Model: ' . $model->getClassName());
130
        }
131
132
        $this->register($model, $offset);
133
    }
134
}