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.

Property::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 8
rs 9.4285
cc 2
eloc 4
nc 2
nop 1
1
<?php
2
3
namespace UCD\Infrastructure\Repository\CharacterRepository\FileRepository;
4
5
use UCD\Exception\InvalidArgumentException;
6
7
class Property
8
{
9
    const BLOCK = 'block';
10
    const GENERAL_CATEGORY = 'gc';
11
    const SCRIPT = 'script';
12
13
    /**
14
     * @var bool[]
15
     */
16
    private static $valid = [
17
        self::BLOCK => true,
18
        self::GENERAL_CATEGORY => true,
19
        self::SCRIPT => true
20
    ];
21
22
    /**
23
     * @var string
24
     */
25
    private $type;
26
27
    /**
28
     * @param string $type
29
     * @throws InvalidArgumentException
30
     */
31
    private function __construct($type)
32
    {
33
        if (!$this->isKnownType($type)) {
34
            throw new InvalidArgumentException();
35
        }
36
37
        $this->type = $type;
38
    }
39
40
    /**
41
     * @param string $type
42
     * @return bool
43
     */
44
    private function isKnownType($type)
45
    {
46
        return array_key_exists($type, self::$valid)
47
            && self::$valid[$type] === true;
48
    }
49
50
    /**
51
     * @param string $type
52
     * @return Property
53
     */
54
    public static function ofType($type)
55
    {
56
        return new self($type);
57
    }
58
59
    /**
60
     * @return string
61
     */
62
    public function __toString()
63
    {
64
        return $this->type;
65
    }
66
}
67