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.

Strings   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 76
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 76
ccs 19
cts 19
cp 1
rs 10
wmc 9

8 Methods

Rating   Name   Duplication   Size   Complexity  
A createFromInt() 0 3 1
A isEmpty() 0 3 1
A toUpperCase() 0 3 1
A toLowerCase() 0 3 1
A length() 0 3 1
A trim() 0 3 1
A guard() 0 5 2
A createFromFloat() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
6
namespace DBUnt1tled\VO\VObjects\Scalar;
7
8
use DBUnt1tled\VO\Exception\InvalidVOArgumentException;
9
use DBUnt1tled\VO\VObjects\ValueObject;
10
11
class Strings extends ValueObject
12
{
13
    /**
14
     * @param mixed $value
15
     * @param mixed ...$other
16
     * @throws \ReflectionException
17
     */
18 21
    public function guard($value, ...$other): void
19
    {
20 21
        parent::guard($value);
21 21
        if (!\is_string($value)) {
22 1
            throw new InvalidVOArgumentException('Value is invalid. Allowed type is string', $value);
23
        }
24 20
    }
25
26
    /**
27
     * @param int $int
28
     * @return Strings
29
     * @throws \ReflectionException
30
     */
31 1
    public static function createFromInt(int $int): self
32
    {
33 1
        return new static((string)$int);
34
    }
35
36
    /**
37
     * @param float $float
38
     * @return Strings
39
     * @throws \ReflectionException
40
     */
41 1
    public static function createFromFloat(float $float): self
42
    {
43 1
        return new static((string)$float);
44
    }
45
46
    /**
47
     * @return int
48
     */
49 1
    public function length(): int
50
    {
51 1
        return mb_strlen($this->value);
52
    }
53
54
    /**
55
     * @return Strings
56
     * @throws \ReflectionException
57
     */
58 2
    public function trim(): self
59
    {
60 2
        return new static(trim($this->value));
61
    }
62
63
    /**
64
     * @return Strings
65
     * @throws \ReflectionException
66
     */
67 1
    public function toUpperCase(): self
68
    {
69 1
        return new static(strtoupper($this->value));
70
    }
71
72
    /**
73
     * @return Strings
74
     * @throws \ReflectionException
75
     */
76 1
    public function toLowerCase(): self
77
    {
78 1
        return new static(strtolower($this->value));
79
    }
80
81
    /**
82
     * @return bool
83
     */
84 1
    public function isEmpty(): bool
85
    {
86 1
        return $this->value === '';
87
    }
88
}
89