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 ( 0e0419...fd5ec3 )
by Pedro
03:04
created

DbTable::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 3
rs 10
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
3
namespace Classes\Db;
4
5
/**
6
 * @author Pedro Alarcao <[email protected]>
7
 * @link   https://github.com/pedro151/ORM-Generator
8
 */
9
class DbTable
10
{
11
    /**
12
     * @author Pedro Alarcao <[email protected]>
13
     */
14
    public function __construct ()
15
    {
16
    }
17
18
    /**
19
     * @var string
20
     */
21
    private $name;
22
23
    /**
24
     * @var string
25
     */
26
    private $schema;
27
28
    /**
29
     * @var string
30
     */
31
    private $database;
32
33
    /**
34
     * @var \Classes\Db\Column[]
35
     */
36
    private $columns = array ();
37
38
    /**
39
     * @var string
40
     */
41
    private $namespace;
42
43
    /**
44
     * @type \Classes\Db\Column[]
45
     */
46
    private $primarykeys = array ();
47
48
    /**
49
     * @type \Classes\Db\Column[]
50
     */
51
    private $foreingkeys = array ();
52
53
    private $dependence = array ();
54
55
    /**
56
     * @type string[]
57
     */
58
    private $sequence = array ();
59
60
    public function populate ( $array )
61
    {
62
        $this->name = $array[ 'table' ];
63
        $this->schema = isset( $array[ 'schema' ] ) ? $array[ 'schema' ] : null;
64
        $this->database = $array[ 'database' ];
65
66
        return $this;
67
    }
68
69
    /**
70
     * @param \Classes\Db\Column $column
71
     */
72
    public function addColumn ( Column $column )
73
    {
74
        $this->columns[ $column->getName () ] = $column;
75
76
        return $this;
77
    }
78
79
    /**
80
     * @param $columnName
81
     *
82
     * @return $this
83
     */
84
    public function createColumn ( $columnName )
85
    {
86
        $this->columns[ $columnName ] = new Column();
87
88
        return $this;
89
    }
90
91
    /**
92
     * @param string $columnName
93
     *
94
     * @return \Classes\Db\Column
95
     */
96
    public function getColumn ( $columnName )
97
    {
98
        if ( isset( $this->columns[ $columnName ] ) )
99
        {
100
            return $this->columns[ $columnName ];
101
        }
102
103
        return;
104
    }
105
106
    /**
107
     * @return \Classes\Db\Column[]
108
     */
109
    public function getPrimaryKeys ()
110
    {
111
        if ( empty ( $this->primarykeys ) )
112
        {
113
            $this->primarykeys = array_filter ( $this->columns , function ( $column ){ return $column->isPrimaryKey (); } );
114
        }
115
116
        return $this->primarykeys;
117
    }
118
119
    /**
120
     * @return bool
121
     */
122
    public function hasPrimaryKey ()
123
    {
124
        if ( empty ( $this->sequence ) )
125
        {
126
            $this->getPrimaryKeys ();
127
        }
128
129
        return ! empty ( $this->sequence );
130
    }
131
132
    /**
133
     * @return \Classes\Db\Column[]
134
     */
135
    public function getForeingkeys ()
136
    {
137
138
        if ( empty ( $this->foreingkeys ) )
139
        {
140
            $this->foreingkeys = array_filter ( $this->columns , function ( $column ){ return $column->isForeingkey (); } );
141
        }
142
143
        return $this->foreingkeys;
144
145
    }
146
147
    /**
148
     * @return \Classes\Db\Column[]
149
     */
150
    public function getDependences ()
151
    {
152
        if ( empty ( $this->dependence ) )
153
        {
154
            $this->dependence = array_filter ( $this->columns , function ( $column ){ return $column->hasDependence (); } );
155
        }
156
157
        return $this->dependence;
158
    }
159
160
    /**
161
     * @return string[]
162
     */
163
    public function getSequences ()
164
    {
165
        if ( empty ( $this->sequence ) )
166
        {
167
            $this->sequence = array_filter ( $this->columns , function ( $column ){ return $column->hasSequence (); } );
168
        }
169
170
        return $this->sequence;
171
    }
172
173
    /**
174
     * @return bool
175
     */
176
    public function hasSequences ()
177
    {
178
        if ( empty ( $this->sequence ) )
179
        {
180
            $this->getSequences ();
181
        }
182
183
        return ! empty ( $this->sequence );
184
    }
185
186
    /**
187
     * @return \Classes\Db\Column[]
188
     */
189
    public function getColumns ()
190
    {
191
        return $this->columns;
192
    }
193
194
    /**
195
     * @return string
196
     */
197
    public function getName ()
198
    {
199
        return $this->name;
200
    }
201
202
    /**
203
     * @return string
204
     */
205
    public function getSchema ()
206
    {
207
        return $this->schema;
208
    }
209
210
    /**
211
     * @return bool
212
     */
213
    public function hasSchema ()
214
    {
215
        return (bool) $this->schema;
216
    }
217
218
    /**
219
     * @return string
220
     */
221
    public function getDatabase ()
222
    {
223
        return $this->database;
224
    }
225
226
    /**
227
     * @return string
228
     */
229
    public function getNamespace ()
230
    {
231
        return $this->namespace;
232
    }
233
234
    /**
235
     * @param string $Namespace
0 ignored issues
show
Documentation introduced by
There is no parameter named $Namespace. Did you maybe mean $namespace?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.

Consider the following example. The parameter $ireland is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $ireland
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was changed, but the annotation was not.

Loading history...
236
     */
237
    public function setNamespace ( $namespace )
238
    {
239
        $this->namespace = $namespace;
240
    }
241
242
}
243