FloatingIp::build()   A
last analyzed

Complexity

Conditions 6
Paths 5

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 9.2222
c 0
b 0
f 0
cc 6
nc 5
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 Graham Campbell <[email protected]>
16
 */
17
final class FloatingIp extends AbstractEntity
18
{
19
    /**
20
     * @var string
21
     */
22
    public $ip;
23
24
    /**
25
     * @var Droplet|null
26
     */
27
    public $droplet;
28
29
    /**
30
     * @var Region
31
     */
32
    public $region;
33
34
    /**
35
     * @param array $parameters
36
     */
37
    public function build(array $parameters)
38
    {
39
        parent::build($parameters);
40
41
        foreach ($parameters as $property => $value) {
42
            if ('droplet' === $property && is_object($value)) {
43
                $this->droplet = new Droplet($value);
44
            }
45
46
            if ('region' === $property && is_object($value)) {
47
                $this->region = new Region($value);
48
            }
49
        }
50
    }
51
}
52