Completed
Pull Request — master (#34)
by Adam
03:27
created

MetricResponse::__construct()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 7
nc 4
nop 1
dl 0
loc 10
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace AcquiaCloudApi\Response;
4
5
/**
6
 * Class MetricResponse
7
 * @package AcquiaCloudApi\Response
8
 */
9
class MetricResponse
10
{
11
    public $metric;
12
    public $datapoints;
13
    public $last_data_at;
14
    public $metadata;
15
    public $links;
16
17
    /**
18
     * MetricResponse constructor.
19
     * @param object $metric
20
     */
21
    public function __construct($metric)
22
    {
23
        $this->metric = $metric->metric;
24
        $this->datapoints = $metric->datapoints;
25
        if (property_exists($metric, 'last_data_at')) {
26
            $this->last_data_at = $metric->last_data_at;
27
        }
28
        $this->metadata = $metric->metadata;
29
        if (property_exists($metric, '_links')) {
30
            $this->links = $metric->_links;
31
        }
32
    }
33
}
34