RenameQuery   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 75%

Importance

Changes 0
Metric Value
dl 0
loc 34
ccs 6
cts 8
cp 0.75
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A toSql() 0 4 1
A getBindings() 0 4 1
1
<?php
2
namespace Wandu\Database\Query;
3
4
use Wandu\Database\Contracts\QueryInterface;
5
6
/**
7
 * @see http://dev.mysql.com/doc/refman/5.7/en/rename-table.html
8
 *
9
 * RENAME TABLE tbl_name TO new_tbl_name
10
 */
11
class RenameQuery implements QueryInterface
12
{
13
    /** @var string */
14
    protected $table;
15
16
    /** @var string */
17
    protected $newTable;
18
19
    /**
20
     * @param string $table
21
     * @param string $newTable
22
     */
23 1
    public function __construct($table, $newTable)
24
    {
25 1
        $this->table = $table;
26 1
        $this->newTable = $newTable;
27 1
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32 1
    public function toSql()
33
    {
34 1
        return "RENAME TABLE `{$this->table}` TO `{$this->newTable}`";
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function getBindings()
41
    {
42
        return [];
43
    }
44
}
45