ManageVms::parseObjects()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 2
c 1
b 0
f 0
nc 2
nop 2
dl 0
loc 3
rs 10
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