Passed
Pull Request — 3.x (#31)
by
unknown
13:18
created

FKAction::setNull()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cycle\Migrations\V2;
6
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
48
    {
49
        return $this->value;
50
    }
51
}
52