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.

DropTableCommand   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
c 1
b 0
f 0
lcom 1
cbo 4
dl 0
loc 53
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setTable() 0 6 1
A cascade() 0 6 1
A getSql() 0 10 2
A preExecute() 0 4 1
1
<?php
2
namespace Rentgen\Schema\Manipulation;
3
4
use Rentgen\Schema\Command;
5
use Rentgen\Database\Table;
6
use Rentgen\Event\TableEvent;
7
8
class DropTableCommand extends Command
9
{
10
    private $table;
11
    private $cascade = false;
12
13
    /**
14
     * Sets a table.
15
     *
16
     * @param Table $table The table instance.
17
     *
18
     * @return DropTableCommand
19
     */
20
    public function setTable(Table $table)
21
    {
22
        $this->table = $table;
23
24
        return $this;
25
    }
26
27
    /**
28
     * Drop table cascade.
29
     *
30
     * @return DropTableCommand
31
     */
32
    public function cascade()
33
    {
34
        $this->cascade = true;
35
36
        return $this;
37
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42
    public function getSql()
43
    {
44
        $sql = sprintf('DROP TABLE %s%s'
45
            , $this->table->getQualifiedName()
46
            , $this->cascade ? ' CASCADE' : ''
47
        );
48
        $sql .= ';';
49
50
        return $sql;
51
    }
52
53
    /**
54
     * {@inheritdoc}
55
     */
56
    protected function preExecute()
57
    {
58
        $this->dispatcher->dispatch('table.drop', new TableEvent($this->table, $this->getSql()));
59
    }
60
}
61