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

SchemaColumnDefinitionEventArgs   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 74
Duplicated Lines 0 %

Test Coverage

Coverage 22.86%

Importance

Changes 0
Metric Value
wmc 8
eloc 18
dl 0
loc 74
ccs 8
cts 35
cp 0.2286
rs 10
c 0
b 0
f 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getColumn() 0 3 1
A getConnection() 0 3 1
A getTableColumn() 0 3 1
A getDatabase() 0 3 1
A getTable() 0 3 1
A setColumn() 0 5 1
A getDatabasePlatform() 0 3 1
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