Passed
Pull Request — dev (#46)
by Def
08:14
created

TableSchema   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 66.67%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
dl 0
loc 28
ccs 4
cts 6
cp 0.6667
rs 10
c 1
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getForeignKeys() 0 3 1
A foreignKeys() 0 3 1
A foreignKey() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Db\Oracle;
6
7
use Yiisoft\Db\Schema\TableSchema as AbstractTableSchema;
8
9
/**
10
 * TableSchema represents the metadata of a database table.
11
 */
12
final class TableSchema extends AbstractTableSchema
13
{
14
    private array $foreignKeys = [];
15
16
    /**
17
     * @return array foreign keys of this table. Each array element is of the following structure:
18
     *
19
     * ```php
20
     * [
21
     *  'ForeignTableName',
22
     *  'fk1' => 'pk1',  // pk1 is in foreign table
23
     *  'fk2' => 'pk2',  // if composite foreign key
24
     * ]
25
     * ```
26
     */
27 1
    public function getForeignKeys(): array
28
    {
29 1
        return $this->foreignKeys;
30
    }
31
32 8
    public function foreignKey(array $value): void
33
    {
34 8
        $this->foreignKeys[] = $value;
35
    }
36
37
    public function foreignKeys(array $value): void
38
    {
39
        $this->foreignKeys = $value;
40
    }
41
}
42