Failed Conditions
Pull Request — develop (#3348)
by Sergei
10:40
created

SchemaColumnDefinitionEventArgs::setColumn()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 5
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\DBAL\Event;
6
7
use Doctrine\DBAL\Connection;
8
use Doctrine\DBAL\Platforms\AbstractPlatform;
9
use Doctrine\DBAL\Schema\Column;
10
11
/**
12
 * Event Arguments used when the portable column definition is generated inside Doctrine\DBAL\Schema\AbstractSchemaManager.
13
 */
14
class SchemaColumnDefinitionEventArgs extends SchemaEventArgs
15
{
16
    /** @var Column|null */
17
    private $column = null;
18
19
    /**
20
     * Raw column data as fetched from the database.
21
     *
22
     * @var mixed[]
23
     */
24
    private $tableColumn;
25
26
    /** @var string */
27
    private $table;
28
29
    /** @var string */
30
    private $database;
31
32
    /** @var Connection */
33
    private $connection;
34
35
    /**
36
     * @param mixed[] $tableColumn
37
     */
38 19
    public function __construct(array $tableColumn, string $table, ?string $database, Connection $connection)
39
    {
40 19
        $this->tableColumn = $tableColumn;
41 19
        $this->table       = $table;
42 19
        $this->database    = $database;
43 19
        $this->connection  = $connection;
44 19
    }
45
46
    /**
47
     * Allows to clear the column which means the column will be excluded from
48
     * tables column list.
49
     */
50
    public function setColumn(?Column $column = null) : self
51
    {
52
        $this->column = $column;
53
54
        return $this;
55
    }
56
57 19
    public function getColumn() : ?Column
58
    {
59 19
        return $this->column;
60
    }
61
62
    /**
63
     * @return mixed[]
64
     */
65
    public function getTableColumn() : array
66
    {
67
        return $this->tableColumn;
68
    }
69
70
    public function getTable() : string
71
    {
72
        return $this->table;
73
    }
74
75
    public function getDatabase() : string
76
    {
77
        return $this->database;
78
    }
79
80
    public function getConnection() : Connection
81
    {
82
        return $this->connection;
83
    }
84
85
    public function getDatabasePlatform() : AbstractPlatform
86
    {
87
        return $this->connection->getDatabasePlatform();
88
    }
89
}
90