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::cascade()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4286
cc 1
eloc 3
nc 1
nop 0
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