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.

Floats::guard()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 3
c 1
b 0
f 0
nc 2
nop 2
dl 0
loc 5
ccs 4
cts 4
cp 1
crap 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace DBUnt1tled\VO\VObjects\Scalar;
6
7
use DBUnt1tled\VO\Exception\InvalidVOArgumentException;
8
use DBUnt1tled\VO\VObjects\ValueObject;
9
10
class Floats extends ValueObject
11
{
12
    /**
13
     * @param mixed $value
14
     * @param mixed ...$other
15
     * @throws \ReflectionException
16
     */
17 3
    public function guard($value, ...$other): void
18
    {
19 3
        parent::guard($value);
20 3
        if (!is_float($value) || !is_finite($value)) {
21 2
            throw new InvalidVOArgumentException('Value is invalid. Allowed type is float', $value);
22
        }
23 2
    }
24
25
    /**
26
     * @param int $int
27
     * @return Floats
28
     * @throws \ReflectionException
29
     */
30 1
    public static function createFromInt(int $int): self
31
    {
32 1
        return new static((float)$int);
33
    }
34
35
    /**
36
     * @param string $string
37
     * @return Floats
38
     * @throws \ReflectionException
39
     */
40 1
    public static function createFromString(string $string): self
41
    {
42 1
        return new static((float)$string);
43
    }
44
}
45