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.

NormalizationParser::parseDecomposition()   A
last analyzed

Complexity

Conditions 4
Paths 6

Size

Total Lines 15
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 15
rs 9.2
cc 4
eloc 10
nc 6
nop 0
1
<?php
2
3
namespace UCD\Infrastructure\Repository\CharacterRepository\XMLRepository\ElementParser\Properties;
4
5
use UCD\Unicode\Character\Properties\Normalization;
6
use UCD\Unicode\Character\Properties\Normalization\Combining;
7
use UCD\Unicode\Character\Properties\Normalization\Decomposition;
8
use UCD\Unicode\Character\Properties\Normalization\Decomposition\Assigned;
9
use UCD\Unicode\Character\Properties\Normalization\Decomposition\Nil;
10
use UCD\Unicode\Character\Properties\Normalization\DecompositionType;
11
12
class NormalizationParser extends BaseParser
13
{
14
    const ATTR_CANONICAL_COMBINING_CLASS = 'ccc';
15
    const ATTR_DECOMPOSITION_TYPE = 'dt';
16
    const ATTR_DECOMPOSITION_MAPPING = 'dm';
17
18
    /**
19
     * @return Normalization
20
     */
21
    protected function parse()
22
    {
23
        $combining = $this->parseCombiningClass();
24
        $decomposition = $this->parseDecomposition();
25
26
        return new Normalization($combining, $decomposition);
27
    }
28
29
    /**
30
     * @return Decomposition
31
     */
32
    private function parseDecomposition()
33
    {
34
        $decompositionType = $this->parseDecompositionType();
35
        $mapping = $this->getAttribute(self::ATTR_DECOMPOSITION_MAPPING);
36
        $placeholders = $this->parsePlaceholders($mapping, $this->codepoint);
37
        $decompositionMap = $this->parseCodepointList($placeholders);
38
        $count = count($decompositionMap);
39
        $isNil = $count === 0 || ($count === 1 && $decompositionMap[0]->equals($this->codepoint));
40
41
        if ($isNil) {
42
            return new Nil($decompositionType);
43
        }
44
45
        return new Assigned($decompositionType, $decompositionMap);
46
    }
47
48
    /**
49
     * @return DecompositionType
50
     */
51
    private function parseDecompositionType()
52
    {
53
        return new DecompositionType($this->getAttribute(self::ATTR_DECOMPOSITION_TYPE));
54
    }
55
56
    /**
57
     * @return Combining
58
     */
59
    private function parseCombiningClass()
60
    {
61
        return new Combining((int)$this->getAttribute(self::ATTR_CANONICAL_COMBINING_CLASS));
62
    }
63
}