MetricResponse::__construct()   A
last analyzed

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
class MetricResponse
6
{
7
    public string $metric;
8
9
    /**
10
     * @var array<array<mixed>> $datapoints
11
     */
12
    public array $datapoints;
13
14
    public ?string $last_data_at;
15
16
    public object $metadata;
17
18
    public ?object $links;
19
20
    public function __construct(object $metric)
21
    {
22
        $this->metric = $metric->metric;
23
        $this->datapoints = $metric->datapoints;
24
        if (property_exists($metric, 'last_data_at')) {
25
            $this->last_data_at = $metric->last_data_at;
26
        }
27
        $this->metadata = $metric->metadata;
28
        if (property_exists($metric, '_links')) {
29
            $this->links = $metric->_links;
30
        }
31
    }
32
}
33