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 ( ae1e4e...bda4f4 )
by Nicholas
07:56
created

LetterCaseParser::parseSimpleMapping()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 9
rs 9.6666
cc 1
eloc 5
nc 1
nop 1
1
<?php
2
3
namespace UCD\Infrastructure\Repository\CharacterRepository\XMLRepository\ElementParser\Properties;
4
5
use UCD\Unicode\Character\Properties\LetterCase\Mapping;
6
use UCD\Unicode\Character\Properties\LetterCase;
7
use UCD\Unicode\Character\Properties\LetterCase\Mappings;
8
use UCD\Unicode\Codepoint;
9
10
class LetterCaseParser extends BaseParser
11
{
12
    const ATTR_LOWERCASE_MAPPING = 'lc';
13
    const ATTR_SIMPLE_LOWERCASE_MAPPING = 'slc';
14
    const ATTR_UPPERCASE_MAPPING = 'uc';
15
    const ATTR_SIMPLE_UPPERCASE_MAPPING = 'suc';
16
    const ATTR_TITLECASE_MAPPING = 'tc';
17
    const ATTR_SIMPLE_TITLECASE_MAPPING = 'stc';
18
    const ATTR_FOLDING_MAPPING = 'cf';
19
    const ATTR_SIMPLE_FOLDING_MAPPING = 'scf';
20
21
    /**
22
     * @return LetterCase
23
     */
24
    protected function parse()
25
    {
26
        $mappings = $this->parseMappings();
27
28
        return new LetterCase($mappings);
29
    }
30
31
    /**
32
     * @return Mappings
33
     */
34
    private function parseMappings()
35
    {
36
        return new Mappings(
37
            $this->parseLowercaseMapping(),
38
            $this->parseUppercaseMapping(),
39
            $this->parseTitlecaseMapping(),
40
            $this->parseFoldingMapping()
41
        );
42
    }
43
44
    /**
45
     * @return Mapping
46
     */
47
    private function parseLowercaseMapping()
48
    {
49
        return new Mapping(
50
            $this->parseSimpleMapping(self::ATTR_SIMPLE_LOWERCASE_MAPPING),
51
            $this->parseMapping(self::ATTR_LOWERCASE_MAPPING)
52
        );
53
    }
54
55
    /**
56
     * @return Mapping
57
     */
58
    private function parseUppercaseMapping()
59
    {
60
        return new Mapping(
61
            $this->parseSimpleMapping(self::ATTR_SIMPLE_UPPERCASE_MAPPING),
62
            $this->parseMapping(self::ATTR_UPPERCASE_MAPPING)
63
        );
64
    }
65
66
    /**
67
     * @return Mapping
68
     */
69
    private function parseTitlecaseMapping()
70
    {
71
        return new Mapping(
72
            $this->parseSimpleMapping(self::ATTR_SIMPLE_TITLECASE_MAPPING),
73
            $this->parseMapping(self::ATTR_TITLECASE_MAPPING)
74
        );
75
    }
76
77
    /**
78
     * @return Mapping
79
     */
80
    private function parseFoldingMapping()
81
    {
82
        return new Mapping(
83
            $this->parseSimpleMapping(self::ATTR_SIMPLE_FOLDING_MAPPING),
84
            $this->parseMapping(self::ATTR_FOLDING_MAPPING)
85
        );
86
    }
87
88
    /**
89
     * @param string $attribute
90
     * @return Codepoint[]
91
     */
92
    private function parseMapping($attribute)
93
    {
94
        $list = $this->parsePlaceholders(
95
            $this->getAttribute($attribute),
96
            $this->codepoint
97
        );
98
99
        return $this->parseCodepointList($list);
100
    }
101
102
103
    /**
104
     * @param string $attribute
105
     * @return Codepoint
106
     */
107
    private function parseSimpleMapping($attribute)
108
    {
109
        $codepoint = $this->parsePlaceholders(
110
            $this->getAttribute($attribute),
111
            $this->codepoint
112
        );
113
114
        return Codepoint::fromHex($codepoint);
115
    }
116
}