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   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 6
Bugs 1 Features 3
Metric Value
wmc 6
c 6
b 1
f 3
lcom 1
cbo 0
dl 0
loc 61
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 2
A getName() 0 7 1
A getTable() 0 4 1
A setTable() 0 6 1
A getColumns() 0 4 1
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