Completed
Pull Request — master (#3708)
by Sergei
15:13
created

SchemaAlterTableEventArgs::getPlatform()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Doctrine\DBAL\Event;
4
5
use Doctrine\DBAL\Platforms\AbstractPlatform;
6
use Doctrine\DBAL\Schema\TableDiff;
7
use function array_merge;
8
use function func_get_args;
9
use function is_array;
10
11
/**
12
 * Event Arguments used when SQL queries for creating tables are generated inside Doctrine\DBAL\Platform\*Platform.
13
 */
14
class SchemaAlterTableEventArgs extends SchemaEventArgs
15
{
16
    /** @var TableDiff */
17
    private $tableDiff;
18
19
    /** @var AbstractPlatform */
20
    private $platform;
21
22
    /** @var string[] */
23
    private $sql = [];
24
25 486
    public function __construct(TableDiff $tableDiff, AbstractPlatform $platform)
26
    {
27 486
        $this->tableDiff = $tableDiff;
28 486
        $this->platform  = $platform;
29 486
    }
30
31
    /**
32
     * @return TableDiff
33
     */
34
    public function getTableDiff()
35
    {
36
        return $this->tableDiff;
37
    }
38
39
    /**
40
     * @return AbstractPlatform
41
     */
42
    public function getPlatform()
43
    {
44
        return $this->platform;
45
    }
46
47
    /**
48
     * Passing multiple SQL statements as an array is deprecated. Pass each statement as an individual argument instead.
49
     *
50
     * @param string|string[] $sql
51
     *
52
     * @return \Doctrine\DBAL\Event\SchemaAlterTableEventArgs
53
     */
54
    public function addSql($sql)
55
    {
56
        $this->sql = array_merge($this->sql, is_array($sql) ? $sql : func_get_args());
57
58
        return $this;
59
    }
60
61
    /**
62
     * @return string[]
63
     */
64 486
    public function getSql()
65
    {
66 486
        return $this->sql;
67
    }
68
}
69