Issues (13)

src/Api/VM/ManageVms.php (1 issue)

Severity
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
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