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.
Completed
Push — master ( ff3008...d4aa5e )
by Nicholas
03:20
created

Collection::has()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 10
rs 9.4285
cc 3
eloc 5
nc 3
nop 1
1
<?php
2
3
namespace UCD\Unicode\Codepoint;
4
5
use UCD\Unicode\Codepoint;
6
use UCD\Unicode\Codepoint\Range\RangeRegexBuilder;
7
use UCD\Unicode\Collection\TraversableBackedCollection;
8
9
class Collection extends TraversableBackedCollection
10
{
11
    /**
12
     * @return \Traversable|int[]
13
     */
14
    public function flatten()
15
    {
16
        /** @var Codepoint $codepoint */
17
        foreach ($this as $codepoint) {
18
            yield $codepoint->getValue();
19
        }
20
    }
21
22
    /**
23
     * @param Codepoint $codepoint
24
     * @return bool
25
     */
26
    public function has(Codepoint $codepoint)
27
    {
28
        foreach ($this as $check) {
29
            if ($codepoint->equals($check)) {
30
                return true;
31
            }
32
        }
33
34
        return false;
35
    }
36
37
    /**
38
     * @return Range[]|Range\Collection
39
     */
40
    public function aggregate()
41
    {
42
        $aggregator = new Aggregator();
43
44
        $this->traverseWith(function (Codepoint $codepoint) use ($aggregator) {
45
            $aggregator->addCodepoint($codepoint);
46
        });
47
48
        return $aggregator->getAggregated();
49
    }
50
51
    /**
52
     * @return string
53
     */
54
    public function toRegexCharacterClass()
55
    {
56
        $builder = new RegexBuilder();
57
58
        $this->traverseWith(function (Codepoint $codepoint) use ($builder) {
59
            $builder->addCodepoint($codepoint);
60
        });
61
62
        return $builder->getCharacterClass();
63
    }
64
}