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.
Passed
Push — develop ( c3b70c...588978 )
by Baptiste
05:12
created

Symbol   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __toString() 0 3 1
A __construct() 0 9 3
A value() 0 3 1
1
<?php
2
declare(strict_types = 1);
3
4
namespace Innmind\Immutable;
5
6
use Innmind\Immutable\Exception\InvalidArgumentException;
7
8
/**
9
 * Think of it as a unique identifier
10
 *
11
 * @template T
12
 */
13
final class Symbol
14
{
15
    private $value;
16
17
    /**
18
     * @param T $value
19
     */
20 6
    public function __construct($value)
21
    {
22 6
        if (!\is_int($value) && !\is_string($value)) {
23 1
            throw new InvalidArgumentException(
24 1
                'A Symbol can be composed only of an int or a string'
25
            );
26
        }
27
28 5
        $this->value = $value;
29 5
    }
30
31
    /**
32
     * @return T
33
     */
34 1
    public function value()
35
    {
36 1
        return $this->value;
37
    }
38
39 1
    public function __toString(): string
40
    {
41 1
        return (string) $this->value;
42
    }
43
}
44