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.

Table   A
last analyzed

Complexity

Total Complexity 15

Size/Duplication

Total Lines 142
Duplicated Lines 0 %

Coupling/Cohesion

Components 3
Dependencies 1

Importance

Changes 11
Bugs 2 Features 6
Metric Value
wmc 15
c 11
b 2
f 6
lcom 3
cbo 1
dl 0
loc 142
rs 10

12 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 2
A getName() 0 4 1
A getQualifiedName() 0 4 1
A addColumn() 0 6 1
A getColumns() 0 4 1
A getColumn() 0 10 3
A addConstraint() 0 7 1
A getConstraints() 0 4 1
A setSchema() 0 4 1
A getSchema() 0 4 1
A setDescription() 0 4 1
A getDescription() 0 4 1
1
<?php
2
3
namespace Rentgen\Database;
4
5
use Rentgen\Database\Constraint\ConstraintInterface;
6
7
/**
8
 * @author Arek Jaskólski <[email protected]>
9
 */
10
class Table implements DatabaseObjectInterface
11
{
12
    private $name;
13
    private $schema;
14
    private $description;
15
    protected $columns = array();
16
    protected $constraints = array();
17
18
    /**
19
     * Constructor.
20
     *
21
     * @param string $name  Table name.
22
     * @param Schema $schem Schema instance.
0 ignored issues
show
Documentation introduced by
There is no parameter named $schem. Did you maybe mean $schema?

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...
23
     */
24
    public function __construct($name, Schema $schema = null)
25
    {
26
        $this->name = $name;
27
        $this->schema = null === $schema ? new Schema() : $schema;
28
    }
29
30
    /**
31
     * Get table name.
32
     *
33
     * @return string Table name.
34
     */
35
    public function getName()
36
    {
37
        return $this->name;
38
    }
39
40
    /**
41
     * Get qualified name (schema name + table name)
42
     *
43
     * @return string Qualified name.
44
     */
45
    public function getQualifiedName()
46
    {
47
        return $this->schema->getName() . '.' .$this->name;
48
    }
49
50
    /**
51
     * Add column to table.
52
     *
53
     * @param Column $column Column instance.
54
     *
55
     * @return Table Table instance.
56
     */
57
    public function addColumn(Column $column)
58
    {
59
        $this->columns[] = $column;
60
61
        return $this;
62
    }
63
64
    /**
65
     * Get columns of table.
66
     *
67
     * @return Column[] Array of Column instances.
68
     */
69
    public function getColumns()
70
    {
71
        return $this->columns;
72
    }
73
74
    /**
75
     * Get column of table.
76
     *
77
     * @param string $name Column name.
78
     *
79
     * @return Column Column instance.
80
     */
81
    public function getColumn($name)
82
    {
83
        foreach ($this->columns as $column) {
84
            if ($column->getName() == $name) {
85
                return $column;
86
            }
87
        }
88
89
        return null;
90
    }
91
92
    /**
93
     * Add contraint to table.
94
     *
95
     * @param ConstraintInterface $constraint Instance of class implements ConstraintInterface.
96
     *
97
     * @return Table Table instance.
98
     */
99
    public function addConstraint(ConstraintInterface $constraint)
100
    {
101
        $constraint->setTable($this);
102
        $this->constraints[] = $constraint;
103
104
        return $this;
105
    }
106
107
    /**
108
     * Get constraints of table.
109
     *
110
     * @return ConstraintInterface[] Array of instances implement ConstraintInterface.
111
     */
112
    public function getConstraints()
113
    {
114
        return $this->constraints;
115
    }
116
117
    /**
118
     * Set schema name.
119
     *
120
     * @param string $name Schama name.
0 ignored issues
show
Bug introduced by
There is no parameter named $name. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

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

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

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

Loading history...
121
     */
122
    public function setSchema(Schema $schema)
123
    {
124
        $this->schema = $schema;
125
    }
126
127
    public function getSchema()
128
    {
129
        return $this->schema;
130
    }
131
132
    /**
133
     * Set table description.
134
     *
135
     * @param string $description Table description.
136
     */
137
    public function setDescription($description)
138
    {
139
        $this->description = $description;
140
    }
141
142
    /**
143
     * Get table description.
144
     *
145
     * @return string
146
     */
147
    public function getDescription()
148
    {
149
        return $this->description;
150
    }
151
}
152