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.

Unique::getColumns()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Rentgen\Database\Constraint;
4
5
use Rentgen\Database\Table;
6
7
class Unique implements ConstraintInterface
8
{
9
    private $columns;
10
    private $table;
11
12
    /**
13
     * Constructor.
14
     *
15
     * @param array|string $columns Column names.
16
     * @param datatype     $table   Table instance.
17
     */
18
    public function __construct($columns, Table $table = null)
19
    {
20
        $this->table = $table;
21
        $this->columns = is_string($columns) ? array($columns) : $columns;
22
    }
23
24
    /**
25
     * {@inheritdoc}
26
     */
27
    public function getName()
28
    {
29
        $tableName = $this->table->getName();
30
        $columnsAsString = implode('_', $this->columns);
31
32
        return $tableName . '_' . $columnsAsString . '_key';
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
39
    public function getTable()
40
    {
41
        return $this->table;
0 ignored issues
show
Bug Compatibility introduced by
The expression $this->table; of type null|Rentgen\Database\Table adds the type Rentgen\Database\Table to the return on line 41 which is incompatible with the return type declared by the interface Rentgen\Database\Constra...aintInterface::getTable of type Rentgen\Database\Constraint\Table.
Loading history...
42
    }
43
44
    /**
45
     * Set table instance.
46
     *
47
     * @param Table $table Table instance.
48
     *
49
     * @return PrimaryKey Self.
50
     */
51
    public function setTable(Table $table)
52
    {
53
        $this->table = $table;
54
55
        return $this;
56
    }
57
58
   /**
59
     * Get column names.
60
     *
61
     * @return array Column names.
62
     */
63
    public function getColumns()
64
    {
65
        return $this->columns;
66
    }
67
}
68