Passed
Pull Request — master (#3836)
by Benjamin
11:25
created

SchemaIndexDefinitionEventArgs   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Test Coverage

Coverage 26.92%

Importance

Changes 0
Metric Value
wmc 6
eloc 14
dl 0
loc 61
ccs 7
cts 26
cp 0.2692
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A setIndex() 0 5 1
A __construct() 0 5 1
A getTableIndex() 0 3 1
A getConnection() 0 3 1
A getTable() 0 3 1
A getIndex() 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\Schema\Index;
9
10
/**
11
 * Event Arguments used when the portable index definition is generated inside Doctrine\DBAL\Schema\AbstractSchemaManager.
12
 */
13
class SchemaIndexDefinitionEventArgs extends SchemaEventArgs
14
{
15
    /** @var Index|null */
16
    private $index;
17
18
    /**
19
     * Raw index data as fetched from the database.
20
     *
21
     * @var array<string, mixed>
22
     */
23
    private $tableIndex;
24
25
    /** @var string */
26
    private $table;
27
28
    /** @var Connection */
29
    private $connection;
30
31
    /**
32
     * @param array<string, mixed> $tableIndex
33
     */
34 26
    public function __construct(array $tableIndex, string $table, Connection $connection)
35
    {
36 26
        $this->tableIndex = $tableIndex;
37 26
        $this->table      = $table;
38 26
        $this->connection = $connection;
39 26
    }
40
41
    /**
42
     * Allows to clear the index which means the index will be excluded from tables index list.
43
     *
44
     * @return $this
45
     */
46
    public function setIndex(?Index $index) : self
47
    {
48
        $this->index = $index;
49
50
        return $this;
51
    }
52
53 26
    public function getIndex() : ?Index
54
    {
55 26
        return $this->index;
56
    }
57
58
    /**
59
     * @return array<string, mixed>
60
     */
61
    public function getTableIndex() : array
62
    {
63
        return $this->tableIndex;
64
    }
65
66
    public function getTable() : string
67
    {
68
        return $this->table;
69
    }
70
71
    public function getConnection() : Connection
72
    {
73
        return $this->connection;
74
    }
75
}
76