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.

Collection::toRegexCharacterClass()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 10
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
namespace UCD\Unicode\Codepoint\Range;
4
5
use UCD\Unicode\Codepoint;
6
use UCD\Unicode\Codepoint\Range;
7
use UCD\Unicode\Codepoint\RegexBuilder;
8
use UCD\Unicode\Collection\TraversableBackedCollection;
9
10
class Collection extends TraversableBackedCollection
11
{
12
    /**
13
     * @return Codepoint[]|Codepoint\Collection
14
     */
15
    public function expand()
16
    {
17
        return new Codepoint\Collection(
18
            $this->yieldCodepoints()
19
        );
20
    }
21
22
    /**
23
     * @return \Generator
24
     */
25
    private function yieldCodepoints()
26
    {
27
        /** @var Range $range */
28
        foreach ($this as $range) {
29
            foreach ($range->expand() as $codepoint) {
30
                yield $codepoint;
31
            }
32
        }
33
    }
34
35
    /**
36
     * @return string
37
     */
38
    public function toRegexCharacterClass()
39
    {
40
        $regexBuilder = new RegexBuilder();
41
42
        $this->traverseWith(function (Range $range) use ($regexBuilder) {
43
            $regexBuilder->addRange($range);
44
        });
45
46
        return $regexBuilder->getCharacterClass();
47
    }
48
}
49