Statistics   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 8

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 8
dl 0
loc 38
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 14 2
1
<?php
2
// Copyright 1999-2021. Plesk International GmbH.
3
4
namespace PleskX\Api\Struct\Server;
5
6
class Statistics extends \PleskX\Api\Struct
7
{
8
    /** @var Statistics\Objects */
9
    public $objects;
10
11
    /** @var Statistics\Version */
12
    public $version;
13
14
    /** @var Statistics\Other */
15
    public $other;
16
17
    /** @var Statistics\LoadAverage */
18
    public $loadAverage;
19
20
    /** @var Statistics\Memory */
21
    public $memory;
22
23
    /** @var Statistics\Swap */
24
    public $swap;
25
26
    /** @var Statistics\DiskSpace[] */
27
    public $diskSpace;
28
29
    public function __construct($apiResponse)
30
    {
31
        $this->objects = new Statistics\Objects($apiResponse->objects);
32
        $this->version = new Statistics\Version($apiResponse->version);
33
        $this->other = new Statistics\Other($apiResponse->other);
34
        $this->loadAverage = new Statistics\LoadAverage($apiResponse->load_avg);
35
        $this->memory = new Statistics\Memory($apiResponse->mem);
36
        $this->swap = new Statistics\Swap($apiResponse->swap);
37
38
        $this->diskSpace = [];
39
        foreach ($apiResponse->diskspace as $disk) {
40
            $this->diskSpace[(string) $disk->device->name] = new Statistics\DiskSpace($disk->device);
41
        }
42
    }
43
}
44