InsightResponse   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 24
c 1
b 0
f 0
dl 0
loc 39
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 17 2
1
<?php
2
3
namespace AcquiaCloudApi\Response;
4
5
use stdClass;
6
7
class InsightResponse
8
{
9
    public string $uuid;
10
11
    public string $label;
12
13
    public string $hostname;
14
15
    public string $status;
16
17
    public string $updatedAt;
18
19
    public string $lastConnectedAt;
20
21
    public object $scores;
22
23
    public object $counts;
24
25
    public object $flags;
26
27
    public object $links;
28
29
    public function __construct(object $insight)
30
    {
31
        $this->uuid = $insight->uuid;
32
        $this->label = $insight->label;
33
        $this->hostname = $insight->hostname;
34
        $this->status = $insight->status;
35
        $this->updatedAt = $insight->updated_at;
36
        $this->lastConnectedAt = $insight->last_connected_at;
37
        $this->scores = $insight->scores;
38
        $this->flags = $insight->flags;
39
        $this->links = $insight->_links;
40
41
        $scores = new stdClass();
42
        foreach ($insight->counts as $name => $counts) {
43
            $scores->$name = new InsightCountResponse($name, $counts);
44
        }
45
        $this->counts = $scores;
46
    }
47
}
48