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.

NumericityParser::parse()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 13
rs 9.4285
cc 2
eloc 7
nc 2
nop 0
1
<?php
2
3
namespace UCD\Infrastructure\Repository\CharacterRepository\XMLRepository\ElementParser\Properties;
4
5
use UCD\Unicode\Character\Properties\Numericity;
6
use UCD\Unicode\Character\Properties\Numericity\NonNumeric;
7
use UCD\Unicode\Character\Properties\Numericity\Numeric;
8
use UCD\Unicode\Character\Properties\Numericity\NumericType;
9
use UCD\Unicode\Character\Properties\Numericity\RationalNumber;
10
11
class NumericityParser extends BaseParser
12
{
13
    const NOT_A_NUMBER = 'NaN';
14
    const ATTR_NUMERIC_TYPE = 'nt';
15
    const ATTR_NUMERIC_VALUE = 'nv';
16
17
    /**
18
     * @return Numericity
19
     */
20
    protected function parse()
21
    {
22
        $numericType = $this->parseNumericType();
23
        $numericValue = $this->getAttribute(self::ATTR_NUMERIC_VALUE);
24
25
        if ($numericValue === self::NOT_A_NUMBER) {
26
            return new NonNumeric($numericType);
27
        }
28
29
        $numericValue = RationalNumber::fromString($numericValue);
30
31
        return new Numeric($numericType, $numericValue);
32
    }
33
34
    /**
35
     * @return NumericType
36
     */
37
    private function parseNumericType()
38
    {
39
        return new NumericType($this->getAttribute(self::ATTR_NUMERIC_TYPE));
40
    }
41
}