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

Complexity

Total Complexity 5

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 33
ccs 9
cts 9
cp 1
rs 10
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A guard() 0 5 3
A createFromString() 0 3 1
A createFromInt() 0 3 1
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