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.

RenameTableCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setTable() 0 6 1
A setNewName() 0 6 1
A getSql() 0 9 1
1
<?php
2
namespace Rentgen\Schema\Manipulation;
3
4
use Rentgen\Schema\Command;
5
use Rentgen\Database\Table;
6
7
class RenameTableCommand extends Command
8
{
9
    private $table;
10
    private $newTableName;
11
12
    /**
13
     * Sets a table.
14
     *
15
     * @param Table $table The table instance.
16
     *
17
     * @return RenameTableCommand
18
     */
19
    public function setTable(Table $table)
20
    {
21
        $this->table = $table;
22
23
        return $this;
24
    }
25
26
    /**
27
     * Sets a table name.
28
     *
29
     * @param string $newTableName New table name.
30
     *
31
     * @return RenameTableCommand
32
     */
33
    public function setNewName($newTableName)
34
    {
35
        $this->newTableName = $newTableName;
36
37
        return $this;
38
    }
39
40
    /**
41
     * {@inheritdoc}
42
     */
43
    public function getSql()
44
    {
45
        $sql = sprintf('ALTER TABLE %s RENAME TO %s;'
46
            , $this->table->getQualifiedName()
47
            , $this->newTableName
48
        );
49
50
        return $sql;
51
    }
52
}
53