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
Pull Request — master (#65)
by
unknown
01:40
created

FloatType::getType()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 0
1
<?php
2
3
namespace Minime\Annotations\Types;
4
5
use Minime\Annotations\Interfaces\TypeInterface;
6
use Minime\Annotations\ParserException;
7
8
class FloatType implements TypeInterface
9
{
10
    /**
11
     * @var TypeInterface
12
     */
13
    private static $instance;
14
15
    public static function getType()
16
    {
17
        if (!isset(self::$instance)) {
18
            self::$instance = new FloatType();
19
        }
20
21
        return self::$instance;
22
    }
23
24
    /**
25
     * Filter a value to be a Float
26
     *
27
     * @param  string                              $value
28
     * @param  null                                $annotation Unused
29
     * @throws \Minime\Annotations\ParserException
30
     * @return float
31
     */
32
    public function parse($value, $annotation = null)
33
    {
34
        if (false === ($value = filter_var($value, FILTER_VALIDATE_FLOAT))) {
35
            throw new ParserException("Raw value must be float. Invalid value '{$value}' given.");
36
        }
37
38
        return $value;
39
    }
40
41
}
42