Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Completed
Pull Request — master (#678)
by Henrique
02:58
created

ResultIterator   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 9
lcom 1
cbo 1
dl 0
loc 57
ccs 0
cts 36
cp 0
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A current() 0 9 2
A next() 0 9 2
A key() 0 9 2
A valid() 0 4 1
A rewind() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of Respect/Validation.
5
 *
6
 * (c) Alexandre Gomes Gaigalas <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the "LICENSE.md"
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Respect\Validation;
13
14
use Iterator;
15
16
final class ResultIterator implements Iterator
17
{
18
    /**
19
     * @var Result[]
20
     */
21
    private $children;
22
23
    /**
24
     * Initializes the object.
25
     *
26
     * @param Result $result
27
     */
28
    public function __construct(Result $result)
29
    {
30
        $this->children = $result->getChildren();
31
    }
32
33
    public function current(): ?Result
34
    {
35
        $current = current($this->children);
36
        if (false === $current) {
37
            return null;
38
        }
39
40
        return $current;
41
    }
42
43
    public function next(): ?Result
44
    {
45
        $next = next($this->children);
46
        if (false == $next) {
47
            return null;
48
        }
49
50
        return $next;
51
    }
52
53
    public function key()
54
    {
55
        $current = $this->current();
56
        if (null === $current) {
57
            return null;
58
        }
59
60
        return $current->getProperties()['reference'] ?? key($this->children);
61
    }
62
63
    public function valid(): bool
64
    {
65
        return null !== $this->current();
66
    }
67
68
    public function rewind(): void
69
    {
70
        reset($this->children);
71
    }
72
}
73