IterableObject   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 21
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A valid() 0 3 1
A rewind() 0 3 1
A key() 0 3 1
A next() 0 3 1
A current() 0 3 1
1
<?php
2
3
4
namespace FNDEV\vShpare\Api\VM\Traits;
5
6
7
trait IterableObject
8
{
9
    public function current()
10
    {
11
        return $this->items[$this->position];
12
    }
13
    public function next()
14
    {
15
        ++$this->position;
16
    }
17
    public function key()
18
    {
19
        return $this->position;
20
    }
21
    public function valid()
22
    {
23
        return array_key_exists($this->position,$this->items);
24
    }
25
    public function rewind()
26
    {
27
        $this->position = 0;
0 ignored issues
show
Bug Best Practice introduced by
The property position does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
28
    }
29
30
}