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 (#923)
by lee
03:57
created

RecursiveExceptionIterator::key()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
crap 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
declare(strict_types=1);
13
14
namespace Respect\Validation\Exceptions;
15
16
use Countable;
17
use RecursiveIterator;
18
19
class RecursiveExceptionIterator implements RecursiveIterator, Countable
20
{
21
    private $exceptions;
22
23 3
    public function __construct(NestedValidationException $parent)
24
    {
25 3
        $this->exceptions = $parent->getRelated();
26 3
    }
27
28
    public function count()
29
    {
30
        return $this->exceptions->count();
31
    }
32
33 2
    public function hasChildren()
34
    {
35 2
        if (!$this->valid()) {
36 1
            return false;
37
        }
38
39 1
        return $this->current() instanceof NestedValidationException;
40
    }
41
42 1
    public function getChildren()
43
    {
44 1
        return new static($this->current());
45
    }
46
47 1
    public function current()
48
    {
49 1
        return $this->exceptions->current();
50
    }
51
52 1
    public function key()
53
    {
54 1
        return $this->exceptions->key();
55
    }
56
57 1
    public function next(): void
58
    {
59 1
        $this->exceptions->next();
60 1
    }
61
62 1
    public function rewind(): void
63
    {
64 1
        $this->exceptions->rewind();
65 1
    }
66
67 2
    public function valid()
68
    {
69 2
        return $this->exceptions->valid();
70
    }
71
}
72