Passed
Push — 2.0 ( 21259a...8b13d0 )
by Sébastien
19:00
created

FkExtractor::onCheck()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 0
dl 0
loc 2
ccs 0
cts 1
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Bdf\Prime\Schema\Transformer\Doctrine;
4
5
use Bdf\Prime\Schema\Constraint\CheckInterface;
6
use Bdf\Prime\Schema\Constraint\ConstraintVisitorInterface;
7
use Bdf\Prime\Schema\Constraint\ForeignKeyInterface;
8
use Doctrine\DBAL\Schema\ForeignKeyConstraint;
9
10
/**
11
 * Transform prime column to doctrine column
12
 */
13
final class FkExtractor implements ConstraintVisitorInterface
14
{
15
    /**
16
     * @var ForeignKeyConstraint[]
17
     */
18
    private $fk = [];
19
20
    /**
21
     * {@inheritdoc}
22
     */
23
    public function onForeignKey(ForeignKeyInterface $foreignKey)
24
    {
25
        $this->fk[] = new ForeignKeyConstraint(
26
            $foreignKey->fields(),
27
            $foreignKey->table(),
28
            $foreignKey->referred(),
29
            $foreignKey->name()
30
        );
31
    }
32
33
    /**
34
     * Get the doctrine foreign key constraints
35
     *
36
     * @return ForeignKeyConstraint[]
37
     */
38 1068
    public function all()
39
    {
40 1068
        return $this->fk;
41
    }
42
43
    /**
44
     * {@inheritdoc}
45
     */
46
    public function onCheck(CheckInterface $check)
47
    {
48
    }
49
}
50