Passed
Pull Request — master (#3070)
by Sergei
07:45
created

TableGeneratorSchemaVisitor   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 52%

Importance

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

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A acceptSchema() 0 7 1
A acceptSequence() 0 2 1
A acceptIndex() 0 2 1
A acceptColumn() 0 2 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
final 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 52
    public function acceptSchema(Schema $schema) : void
26
    {
27 52
        $table = $schema->createTable($this->generatorTableName);
28
29 52
        $table->addColumn('sequence_name', 'string', ['length' => 255]);
30 52
        $table->addColumn('sequence_value', 'integer', ['default' => 1]);
31 52
        $table->addColumn('sequence_increment_by', 'integer', ['default' => 1]);
32 52
    }
33
34 52
    public function acceptTable(Table $table) : void
35
    {
36 52
    }
37
38 52
    public function acceptColumn(Table $table, Column $column) : void
39
    {
40 52
    }
41
42
    public function acceptForeignKey(Table $localTable, ForeignKeyConstraint $fkConstraint) : void
43
    {
44
    }
45
46
    public function acceptIndex(Table $table, Index $index) : void
47
    {
48
    }
49
50
    public function acceptSequence(Sequence $sequence) : void
51
    {
52
    }
53
}
54