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.
Completed
Push — master ( f74d05...468b27 )
by Pedro
07:16 queued 04:16
created

DbTables::toArrayFileName()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 15
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 7
nc 3
nop 0
1
<?php
2
3
namespace Classes\Db\Iterators;
4
5
use Classes\Db\DbTable;
6
use Classes\Maker\AbstractMaker;
7
8
class DbTables implements \ArrayAccess , \SeekableIterator , \Countable
0 ignored issues
show
Coding Style introduced by
Expected 0 spaces between "ArrayAccess" and comma; 1 found
Loading history...
Coding Style introduced by
Expected 0 spaces between "SeekableIterator" and comma; 1 found
Loading history...
9
{
10
11
    /**
12
     * @type DbTable[]
13
     */
14
    private $objDbTables = array ();
15
16
    private $position = 0;
17
18
    public function offsetExists ( $offset )
19
    {
20
        return isset( $this->objDbTables[ trim ( $offset ) ] );
21
    }
22
23
    public function offsetGet ( $offset )
24
    {
25
        return $this->objDbTables[ trim ( $offset ) ];
26
    }
27
28
    public function offsetSet ( $offset , $value )
29
    {
30
        return $this->objDbTables[ trim ( $offset ) ] = $value;
31
    }
32
33
    public function offsetUnset ( $offset )
34
    {
35
        unset( $this->objDbTables[ trim ( $offset ) ] );
36
37
        return $this;
38
    }
39
40
    public function count ()
41
    {
42
        return count ( $this->objDbTables );
43
    }
44
45
    /**
46
     * convert array
47
     */
48
    public function toArrayFileName ()
49
    {
50
        if ( ! empty( $this->toArrayFileName ) )
51
        {
52
            return $this->toArrayFileName;
0 ignored issues
show
Bug introduced by
The property toArrayFileName does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
53
        }
54
55
        foreach ( $this->objDbTables as $objDbTable )
56
        {
57
            $this->toArrayFileName[] = AbstractMaker::getClassName ( $objDbTable->getName () )
58
                                       . '.php';
59
        }
60
61
        return $this->toArrayFileName;
62
    }
63
64
    /* Method required for SeekableIterator interface */
65
66
    public function seek ( $position )
67
    {
68
        $current = array_keys ( $this->objDbTables );
69
        if ( ! isset( $this->objDbTables[ $current[ $position ] ] ) )
70
        {
71
            throw new OutOfBoundsException( "invalid seek position ($position)" );
72
        }
73
74
        $this->position = $position;
75
    }
76
77
    /* Methods required for Iterator interface */
78
79
    public function rewind ()
80
    {
81
        $this->position = 0;
82
    }
83
84
    public function current ()
85
    {
86
        $current = array_keys ( $this->objDbTables );
87
88
        return $this->objDbTables[ $current[ $this->position ] ];
89
    }
90
91
    public function key ()
92
    {
93
        $current = array_keys ( $this->objDbTables );
94
95
        return $current[ $this->position ];
96
    }
97
98
    public function next ()
99
    {
100
        ++ $this->position;
101
    }
102
103
    public function valid ()
104
    {
105
        $current = array_keys ( $this->objDbTables );
106
107
        return isset( $current[ $this->position ] );
108
    }
109
}