Completed
Pull Request — master (#3189)
by Jarek
28:19 queued 25:37
created

SchemaCreateTableEventArgs   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 83
Duplicated Lines 0 %

Test Coverage

Coverage 28.57%

Importance

Changes 0
Metric Value
wmc 8
eloc 19
dl 0
loc 83
ccs 6
cts 21
cp 0.2857
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A addSql() 0 9 2
A getSql() 0 3 1
A getOptions() 0 3 1
A getPlatform() 0 3 1
A getColumns() 0 3 1
A getTable() 0 3 1
A __construct() 0 6 1
1
<?php
2
3
namespace Doctrine\DBAL\Event;
4
5
use Doctrine\DBAL\Platforms\AbstractPlatform;
6
use Doctrine\DBAL\Schema\Table;
7
use function array_merge;
8
use function is_array;
9
10
/**
11
 * Event Arguments used when SQL queries for creating tables are generated inside Doctrine\DBAL\Platform\AbstractPlatform.
12
 */
13
class SchemaCreateTableEventArgs extends SchemaEventArgs
14
{
15
    /** @var Table */
16
    private $table;
17
18
    /** @var mixed[][] */
19
    private $columns;
20
21
    /** @var mixed[] */
22
    private $options;
23
24
    /** @var AbstractPlatform */
25
    private $platform;
26
27
    /** @var string[] */
28
    private $sql = [];
29
30
    /**
31
     * @param mixed[][] $columns
32
     * @param mixed[]   $options
33
     */
34 486
    public function __construct(Table $table, array $columns, array $options, AbstractPlatform $platform)
35
    {
36 486
        $this->table    = $table;
37 486
        $this->columns  = $columns;
38 486
        $this->options  = $options;
39 486
        $this->platform = $platform;
40 486
    }
41
42
    /**
43
     * @return Table
44
     */
45
    public function getTable()
46
    {
47
        return $this->table;
48
    }
49
50
    /**
51
     * @return mixed[][]
52
     */
53
    public function getColumns()
54
    {
55
        return $this->columns;
56
    }
57
58
    /**
59
     * @return mixed[]
60
     */
61
    public function getOptions()
62
    {
63
        return $this->options;
64
    }
65
66
    /**
67
     * @return AbstractPlatform
68
     */
69
    public function getPlatform()
70
    {
71
        return $this->platform;
72
    }
73
74
    /**
75
     * @param string|string[] $sql
76
     *
77
     * @return \Doctrine\DBAL\Event\SchemaCreateTableEventArgs
78
     */
79
    public function addSql($sql)
80
    {
81
        if (is_array($sql)) {
82
            $this->sql = array_merge($this->sql, $sql);
83
        } else {
84
            $this->sql[] = $sql;
85
        }
86
87
        return $this;
88
    }
89
90
    /**
91
     * @return string[]
92
     */
93
    public function getSql()
94
    {
95
        return $this->sql;
96
    }
97
}
98