Passed
Push — 6.0 ( d42c5f...ee4eb8 )
by Olivier
01:47
created

Timestamp   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 11
dl 0
loc 30
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __set_state() 0 6 1
A __construct() 0 9 1
1
<?php
2
3
namespace ICanBoogie\ActiveRecord\Schema;
4
5
use Attribute;
6
7
#[Attribute(Attribute::TARGET_PROPERTY)]
8
final class Timestamp extends Column
9
{
10
    public const CURRENT_TIMESTAMP = 'CURRENT_TIMESTAMP';
11
12
    /**
13
     * @param array{
14
     *     null: bool,
15
     *     default: ?string,
16
     *     unique: bool,
17
     * } $an_array
18
     */
19
    public static function __set_state(array $an_array): self
20
    {
21
        return new self(
22
            $an_array['null'],
23
            $an_array['default'],
24
            $an_array['unique'],
25
        );
26
    }
27
28
    public function __construct(
29
        bool $null = false,
30
        ?string $default = null,
31
        bool $unique = false,
32
    ) {
33
        parent::__construct(
34
            null: $null,
35
            default: $default,
36
            unique: $unique,
37
        );
38
    }
39
}
40