ManageVms   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
eloc 8
c 2
b 0
f 1
dl 0
loc 16
rs 10
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A first() 0 2 2
A parseObjects() 0 3 2
A __construct() 0 3 1
1
<?php
2
namespace FNDEV\vShpare\Api\VM;
3
4
use FNDEV\vShpare\Api\VM\Traits\CountAbleObject;
5
use FNDEV\vShpare\Api\VM\Traits\IterableObject;
6
use GuzzleHttp\Psr7\Response;
7
8
class ManageVms implements \Iterator,\Countable {
9
    use IterableObject,CountAbleObject;
10
11
    private array $items = [];
12
    private int $position = 0;
0 ignored issues
show
introduced by
The private property $position is not used, and could be removed.
Loading history...
13
    public function __construct($vms,$HttpClient)
14
    {
15
        $this->parseObjects($vms,$HttpClient);
16
    }
17
    public function parseObjects($vms,$HttpClient){
18
        foreach ($vms->value as $VmProperties){
19
            array_push($this->items,new VmSource($HttpClient,$VmProperties,$VmProperties->vm));
20
        }
21
    }
22
    public function first(){
23
        return (count($this->items) >= 1) ? $this->items[0] : null ;
24
    }
25
26
27
}
28