| Total Complexity | 6 | 
| Total Lines | 52 | 
| Duplicated Lines | 0 % | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 9 | class ForeignKey  | 
            ||
| 10 | { | 
            ||
| 11 | public const FOREIGN_TABLE = 'foreignTable';  | 
            ||
| 12 | public const LOCAL_COLUMNS = 'localColumns';  | 
            ||
| 13 | public const FOREIGN_COLUMNS = 'foreignColumns';  | 
            ||
| 14 | |||
| 15 | /**  | 
            ||
| 16 | * @var array<string, string|array<string>>  | 
            ||
| 17 | */  | 
            ||
| 18 | private $foreignKey;  | 
            ||
| 19 | |||
| 20 | /**  | 
            ||
| 21 | * @param array<string, string|array<string>> $foreignKey  | 
            ||
| 22 | */  | 
            ||
| 23 | public function __construct(array $foreignKey)  | 
            ||
| 24 |     { | 
            ||
| 25 | $this->foreignKey = $foreignKey;  | 
            ||
| 26 | }  | 
            ||
| 27 | |||
| 28 | public static function createFromFk(ForeignKeyConstraint $fk): self  | 
            ||
| 29 |     { | 
            ||
| 30 | return new self([  | 
            ||
| 31 | self::FOREIGN_TABLE => $fk->getForeignTableName(),  | 
            ||
| 32 | self::LOCAL_COLUMNS => $fk->getUnquotedLocalColumns(),  | 
            ||
| 33 | self::FOREIGN_COLUMNS => $fk->getUnquotedForeignColumns(),  | 
            ||
| 34 | ]);  | 
            ||
| 35 | }  | 
            ||
| 36 | |||
| 37 | /**  | 
            ||
| 38 | * @return array<string>  | 
            ||
| 39 | */  | 
            ||
| 40 | public function getUnquotedLocalColumns(): array  | 
            ||
| 41 |     { | 
            ||
| 42 | return $this->foreignKey[self::LOCAL_COLUMNS];  | 
            ||
| 
                                                                                                    
                        
                         | 
                |||
| 43 | }  | 
            ||
| 44 | |||
| 45 | /**  | 
            ||
| 46 | * @return array<string>  | 
            ||
| 47 | */  | 
            ||
| 48 | public function getUnquotedForeignColumns(): array  | 
            ||
| 49 |     { | 
            ||
| 50 | return $this->foreignKey[self::FOREIGN_COLUMNS];  | 
            ||
| 51 | }  | 
            ||
| 52 | |||
| 53 | public function getForeignTableName(): string  | 
            ||
| 54 |     { | 
            ||
| 55 | return $this->foreignKey[self::FOREIGN_TABLE];  | 
            ||
| 56 | }  | 
            ||
| 57 | |||
| 58 | public function getCacheKey(): string  | 
            ||
| 61 | }  | 
            ||
| 62 | }  | 
            ||
| 63 |