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   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 0
cbo 5
dl 0
loc 31
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A parse() 0 13 2
A parseNumericType() 0 4 1
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
}