Passed
Pull Request — 3.x (#31)
by
unknown
11:39
created

FKAction   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 7
eloc 14
c 1
b 0
f 0
dl 0
loc 43
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A value() 0 3 1
A __construct() 0 3 1
A restrict() 0 3 1
A noAction() 0 3 1
A setNull() 0 3 1
A cascade() 0 3 1
A setDefault() 0 3 1
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