FloatingIp::build()   B
last analyzed

Complexity

Conditions 6
Paths 5

Size

Total Lines 14
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
c 0
b 0
f 0
rs 8.8571
cc 6
eloc 7
nc 5
nop 1
1
<?php
2
/*
3
 *   This file is part of the Vultr PHP library.
4
 *
5
 *   (c) Albert Leitato <[email protected]>
6
 *
7
 *   For the full copyright and license information, please view the LICENSE
8
 *   file that was distributed with this source code.
9
 */
10
namespace Vultr\Entity;
11
12
/**
13
 * @author Albert Leitato <[email protected]>
14
 */
15
final class FloatingIp extends AbstractEntity
16
{
17
    /**
18
     * @var string
19
     */
20
    public $subid;
21
22
    /**
23
     * @var Droplet|null
24
     */
25
    public $droplet;
26
27
    /**
28
     * @var Region
29
     */
30
    public $region;
31
32
    /**
33
     * @param array $parameters
34
     */
35
    public function build(array $parameters)
36
    {
37
        parent::build($parameters);
38
39
        foreach ($parameters as $property => $value) {
40
            if ('droplet' === $property && \is_object($value)) {
41
                $this->droplet = new Droplet($value);
42
            }
43
44
            if ('region' === $property && \is_object($value)) {
45
                $this->region = new Region($value);
46
            }
47
        }
48
    }
49
}
50