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

CodepointSearchByIteration::getByCodepoints()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace UCD\Unicode\Character\Repository\Capability;
4
5
use UCD\Unicode\Character;
6
use UCD\Unicode\Character\Repository\CharacterNotFoundException;
7
use UCD\Unicode\Codepoint;
8
use UCD\Unicode\CodepointAssigned;
9
10
trait CodepointSearchByIteration
11
{
12
    /**
13
     * @param Codepoint $codepoint
14
     * @throws CharacterNotFoundException
15
     * @return CodepointAssigned
16
     */
17
    public function getByCodepoint(Codepoint $codepoint)
18
    {
19
        foreach ($this->getAll() as $character) {
20
            if ($codepoint->equals($character->getCodepoint())) {
21
                return $character;
22
            }
23
        }
24
25
        throw CharacterNotFoundException::withCodepoint($codepoint);
26
    }
27
28
    /**
29
     * @param Codepoint\Collection $codepoints
30
     * @return Character\Collection
31
     */
32
    public function getByCodepoints(Codepoint\Collection $codepoints)
33
    {
34
        return new Character\Collection(
35
            $this->unionAgainstCodepoints($codepoints)
36
        );
37
    }
38
39
    /**
40
     * @param Codepoint\Collection $codepoints
41
     * @return \Generator
42
     */
43
    protected function unionAgainstCodepoints(Codepoint\Collection $codepoints)
44
    {
45
        foreach ($this->getAll() as $character) {
46
            if ($codepoints->has($character->getCodepoint())) {
47
                yield $character;
48
            }
49
        }
50
    }
51
52
    /**
53
     * @return CodepointAssigned[]
54
     */
55
    abstract public function getAll();
56
}