Action::setStartedAt()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of the DigitalOceanV2 library.
5
 *
6
 * (c) Antoine Corcy <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace DigitalOceanV2\Entity;
13
14
/**
15
 * @author Antoine Corcy <[email protected]>
16
 * @author Graham Campbell <[email protected]>
17
 */
18
final class Action extends AbstractEntity
19
{
20
    /**
21
     * @var int
22
     */
23
    public $id;
24
25
    /**
26
     * @var string
27
     */
28
    public $status;
29
30
    /**
31
     * @var string
32
     */
33
    public $type;
34
35
    /**
36
     * @var string
37
     */
38
    public $startedAt;
39
40
    /**
41
     * @var string
42
     */
43
    public $completedAt;
44
45
    /**
46
     * @var string
47
     */
48
    public $resourceId;
49
50
    /**
51
     * @var string
52
     */
53
    public $resourceType;
54
55
    /**
56
     * @var Region
57
     */
58
    public $region;
59
60
    /**
61
     * @var string
62
     */
63
    public $regionSlug;
64
65
    /**
66
     * @param array $parameters
67
     */
68
    public function build(array $parameters)
69
    {
70
        parent::build($parameters);
71
72
        foreach ($parameters as $property => $value) {
73
            if ('region' === $property && is_object($value)) {
74
                $this->region = new Region($value);
75
            }
76
        }
77
    }
78
79
    /**
80
     * @param string $completedAt
81
     */
82
    public function setCompletedAt($completedAt)
83
    {
84
        $this->completedAt = static::convertDateTime($completedAt);
85
    }
86
87
    /**
88
     * @param string $startedAt
89
     */
90
    public function setStartedAt($startedAt)
91
    {
92
        $this->startedAt = static::convertDateTime($startedAt);
93
    }
94
}
95