Completed
Pull Request — develop (#3576)
by Jonathan
64:38 queued 61:53
created

TableGeneratorSchemaVisitor   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Test Coverage

Coverage 52%

Importance

Changes 0
Metric Value
wmc 7
eloc 7
dl 0
loc 54
ccs 13
cts 25
cp 0.52
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A acceptSchema() 0 6 1
A acceptSequence() 0 2 1
A acceptIndex() 0 2 1
A acceptColumn() 0 2 1
A __construct() 0 3 1
A acceptTable() 0 2 1
A acceptForeignKey() 0 2 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\DBAL\Id;
6
7
use Doctrine\DBAL\Schema\Column;
8
use Doctrine\DBAL\Schema\ForeignKeyConstraint;
9
use Doctrine\DBAL\Schema\Index;
10
use Doctrine\DBAL\Schema\Schema;
11
use Doctrine\DBAL\Schema\Sequence;
12
use Doctrine\DBAL\Schema\Table;
13
use Doctrine\DBAL\Schema\Visitor\Visitor;
14
15
class TableGeneratorSchemaVisitor implements Visitor
16
{
17
    /** @var string */
18
    private $generatorTableName;
19
20 52
    public function __construct(string $generatorTableName = 'sequences')
21
    {
22 52
        $this->generatorTableName = $generatorTableName;
23 52
    }
24
25
    /**
26
     * {@inheritdoc}
27
     */
28 52
    public function acceptSchema(Schema $schema) : void
29
    {
30 52
        $table = $schema->createTable($this->generatorTableName);
31 52
        $table->addColumn('sequence_name', 'string');
32 52
        $table->addColumn('sequence_value', 'integer', ['default' => 1]);
33 52
        $table->addColumn('sequence_increment_by', 'integer', ['default' => 1]);
34 52
    }
35
36
    /**
37
     * {@inheritdoc}
38
     */
39 52
    public function acceptTable(Table $table) : void
40
    {
41 52
    }
42
43
    /**
44
     * {@inheritdoc}
45
     */
46 52
    public function acceptColumn(Table $table, Column $column) : void
47
    {
48 52
    }
49
50
    /**
51
     * {@inheritdoc}
52
     */
53
    public function acceptForeignKey(Table $localTable, ForeignKeyConstraint $fkConstraint) : void
54
    {
55
    }
56
57
    /**
58
     * {@inheritdoc}
59
     */
60
    public function acceptIndex(Table $table, Index $index) : void
61
    {
62
    }
63
64
    /**
65
     * {@inheritdoc}
66
     */
67
    public function acceptSequence(Sequence $sequence) : void
68
    {
69
    }
70
}
71