Completed
Push — master ( a4e176...8c9478 )
by Adam
02:50
created

Iterator   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 0
dl 0
loc 45
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A current() 0 4 1
A key() 0 4 1
A valid() 0 4 2
A next() 0 5 1
A rewind() 0 5 1
1
<?php
2
3
namespace BestServedCold\PhalueObjects\VOArray;
4
5
/**
6
 * Trait Iterator
7
 *
8
 * @package BestServedCold\PhalueObjects\VOArray
9
 */
10
trait Iterator
11
{
12
    /**
13
     * @return mixed
14
     */
15 4
    public function current()
16
    {
17 4
        return current($this->value);
0 ignored issues
show
Bug introduced by
The property value does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
18
    }
19
20
    /**
21
     * @return mixed
22
     */
23 3
    public function key()
24
    {
25 3
        return key($this->value);
26
    }
27
28
    /**
29
     * @return bool
30
     */
31 1
    public function valid()
0 ignored issues
show
Coding Style introduced by
function valid() does not seem to conform to the naming convention (^(?:is|has|should|may|supports)).

This check examines a number of code elements and verifies that they conform to the given naming conventions.

You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.

Loading history...
32
    {
33 1
        return key($this->value) !== null && key($this->value) !== false;
34
    }
35
36
    /**
37
     * @return $this
38
     */
39 2
    public function next()
40
    {
41 2
        next($this->value);
42 2
        return $this;
43
    }
44
45
    /**
46
     * @return $this
47
     */
48 1
    public function rewind()
49
    {
50 1
        reset($this->value);
51 1
        return $this;
52
    }
53
54
}
55