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

Complexity

Total Complexity 6

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 6
c 0
b 0
f 0
lcom 1
cbo 1
dl 0
loc 60
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 2
A isKnownType() 0 5 2
A ofType() 0 4 1
A __toString() 0 4 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