Completed
Pull Request — master (#42)
by Jose Manuel
01:40
created

GqlIterator   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 29
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 29
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A rewind() 0 4 1
A current() 0 4 1
A key() 0 4 1
A next() 0 4 1
A valid() 0 6 2
1
<?php
2
3
namespace Softonic\GraphQL\Traits;
4
5
trait GqlIterator
6
{
7 96
    public function rewind()
8
    {
9 96
        reset($this->arguments);
0 ignored issues
show
Bug introduced by
The property arguments 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...
10 96
    }
11
12 96
    public function current()
13
    {
14 96
        return current($this->arguments);
15
    }
16
17 96
    public function key()
18
    {
19 96
        return key($this->arguments);
20
    }
21
22 96
    public function next()
23
    {
24 96
        return next($this->arguments);
25
    }
26
27 96
    public function valid()
28
    {
29 96
        $key = key($this->arguments);
30
31 96
        return ($key !== null && $key !== false);
32
    }
33
}
34