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

GqlIterator::key()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
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