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.

Row   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 18
c 1
b 0
f 0
dl 0
loc 56
rs 10
wmc 8

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 15 4
A __call() 0 11 2
A offsetGet() 0 7 2
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
14
namespace O2System\Reactor\Models\Sql\DataObjects\Result;
15
16
// ------------------------------------------------------------------------
17
18
use O2System\Database;
19
use O2System\Reactor\Models\Sql\Model;
20
use O2System\Spl\DataStructures\SplArrayObject;
21
use O2System\Spl\Info\SplClassInfo;
22
23
/**
24
 * Class Row
25
 *
26
 * @package O2System\Reactor\Models\Sql\DataObjects
27
 */
28
class Row extends SplArrayObject
29
{
30
    /**
31
     * Row Model Instance
32
     *
33
     * @var Model
34
     */
35
    private $model;
36
37
    /**
38
     * Row::__construct
39
     *
40
     * @param Database\DataObjects\Result\Row|array $row
41
     * @param Model                                 $model
42
     */
43
    public function __construct($row, Model &$model)
44
    {
45
        $this->model = new SplClassInfo($model);
0 ignored issues
show
Documentation Bug introduced by
It seems like new O2System\Spl\Info\SplClassInfo($model) of type O2System\Spl\Info\SplClassInfo is incompatible with the declared type O2System\Reactor\Models\Sql\Model of property $model.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
46
47
        if ( ! models()->has($this->model->getParameter())) {
48
            models()->register($this->model->getParameter(), $model);
49
        }
50
51
        if ($row instanceof Database\DataObjects\Result\Row) {
52
            parent::__construct($row->getArrayCopy());
53
        } elseif (is_array($row)) {
0 ignored issues
show
introduced by
The condition is_array($row) is always true.
Loading history...
54
            parent::__construct($row);
55
        }
56
57
        models($this->model->getParameter())->row = $this;
58
    }
59
60
    // ------------------------------------------------------------------------
61
62
    public function offsetGet($offset)
63
    {
64
        if (null !== ($result = $this->__call($offset))) {
65
            return $result;
66
        }
67
68
        return parent::offsetGet($offset);
69
    }
70
71
    // ------------------------------------------------------------------------
72
73
    public function __call($method, $args = [])
74
    {
75
        $model = models($this->model->getParameter());
0 ignored issues
show
Bug introduced by
The method getParameter() does not exist on O2System\Reactor\Models\Sql\Model. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

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

75
        $model = models($this->model->/** @scrutinizer ignore-call */ getParameter());
Loading history...
76
77
        if (method_exists($model, $method)) {
78
            $model->row = $this;
79
80
            return call_user_func_array([&$model, $method], $args);
81
        }
82
83
        return null;
84
    }
85
}