GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

ChangeSet::hasChangeFor()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
c 0
b 0
f 0
rs 9.4285
cc 3
eloc 5
nc 3
nop 1
1
<?php
2
3
namespace Isolate\UnitOfWork\Entity\Value;
4
5
use Isolate\UnitOfWork\Exception\RuntimeException;
6
use Isolate\UnitOfWork\Entity\Value\Change\ScalarChange;
7
8
/**
9
 * @api
10
 */
11
class ChangeSet extends \ArrayObject
12
{
13
    /**
14
     * @param $propertyName
15
     * @return bool
16
     * 
17
     * @api
18
     */
19
    public function hasChangeFor($propertyName)
20
    {
21
        foreach ($this->getIterator() as $change) {
22
            /* @var ScalarChange $change */
23
            if ($change->isFor($propertyName)) {
24
                return true;
25
            }
26
        }
27
28
        return false;
29
    }
30
31
    /**
32
     * @param $propertyName
33
     * @return Change
34
     * @throws RuntimeException
35
     * 
36
     * @api
37
     */
38
    public function getChangeFor($propertyName)
39
    {
40
        foreach ($this->getIterator() as $change) {
41
            /* @var \Isolate\UnitOfWork\Entity\Value\Change\ScalarChange $change */
42
            if ($change->isFor($propertyName)) {
43
                return $change;
44
            }
45
        }
46
47
        throw new RuntimeException(sprintf("There are no changes for \"%s\" property.", $propertyName));
48
    }
49
50
    /**
51
     * @param array $properties
52
     * @return bool
53
     * 
54
     * @api
55
     */
56
    public function hasChangesForAny(array $properties = [])
57
    {
58
        foreach ($properties as $propertyName) {
59
            if ($this->hasChangeFor($propertyName)) {
60
                return true;
61
            }
62
        }
63
64
        return false;
65
    }
66
67
    /**
68
     * @return ScalarChange[]
69
     * 
70
     * @api
71
     */
72
    public function all()
73
    {
74
        return $this->getIterator();
75
    }
76
77
    /**
78
     * @param mixed $index
79
     *
80
     * @return Change
81
     */
82
    public function offsetGet($index)
83
    {
84
        parent::offsetGet($index);
85
    }
86
}
87