Total Complexity | 7 |
Total Lines | 43 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
7 | class FKAction |
||
8 | { |
||
9 | public const CASCADE = 'CASCADE'; |
||
10 | public const SET_NULL = 'SET NULL'; |
||
11 | public const SET_DEFAULT = 'SET DEFAULT'; |
||
12 | public const RESTRICT = 'RESTRICT'; |
||
13 | public const NO_ACTION = 'NO ACTION'; |
||
14 | |||
15 | private string $value; |
||
16 | |||
17 | private function __construct(string $value) |
||
18 | { |
||
19 | $this->value = $value; |
||
20 | } |
||
21 | |||
22 | public static function cascade(): self |
||
23 | { |
||
24 | return new self(self::CASCADE); |
||
25 | } |
||
26 | |||
27 | public static function setNull(): self |
||
28 | { |
||
29 | return new self(self::SET_NULL); |
||
30 | } |
||
31 | |||
32 | public static function setDefault(): self |
||
33 | { |
||
34 | return new self(self::SET_DEFAULT); |
||
35 | } |
||
36 | |||
37 | public static function restrict(): self |
||
38 | { |
||
39 | return new self(self::RESTRICT); |
||
40 | } |
||
41 | |||
42 | public static function noAction(): self |
||
43 | { |
||
44 | return new self(self::NO_ACTION); |
||
45 | } |
||
46 | |||
47 | public function value(): string |
||
50 | } |
||
51 | } |
||
52 |