Total Complexity | 9 |
Total Lines | 58 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
8 | class ForeignKeyParser extends ForeignKey |
||
9 | { |
||
10 | private ForeignKey $foreignKey; |
||
11 | private string $tableName; |
||
12 | |||
13 | public function __construct(ForeignKey $foreignKey, string $tableName) |
||
14 | { |
||
15 | $this->foreignKey = $foreignKey; |
||
16 | $this->tableName = $tableName; |
||
17 | } |
||
18 | |||
19 | public function getName(): string |
||
20 | { |
||
21 | return $this->index->name ?? sprintf( |
||
|
|||
22 | '%s_%s_%s_%s_fk', |
||
23 | $this->getInnerTable(), |
||
24 | $this->getInnerKeys()[0], |
||
25 | $this->getOuterTable(), |
||
26 | $this->getOuterKeys()[0] |
||
27 | ); |
||
28 | } |
||
29 | |||
30 | public function getInnerTable(): string |
||
31 | { |
||
32 | return $this->tableName; |
||
33 | } |
||
34 | |||
35 | public function getInnerKeys(): array |
||
38 | } |
||
39 | |||
40 | public function getOuterTable(): string |
||
41 | { |
||
42 | return $this->foreignKey->outerTable; |
||
43 | } |
||
44 | |||
45 | public function getOuterKeys(): array |
||
46 | { |
||
47 | return $this->foreignKey->outerKeys; |
||
48 | } |
||
49 | |||
50 | public function getOnDelete(): string |
||
51 | { |
||
52 | return $this->foreignKey->onDelete->value(); |
||
53 | } |
||
54 | |||
55 | public function getOnUpdate(): string |
||
56 | { |
||
57 | return $this->foreignKey->onUpdate->value(); |
||
58 | } |
||
59 | |||
60 | public function getOptions(): array |
||
66 | ]; |
||
67 | } |
||
68 | } |
||
69 |