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.
Completed
Push — master ( 993294...efc1ec )
by Nicholas
03:02
created

TransformationFormat::equals()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
rs 9.4285
cc 2
eloc 3
nc 2
nop 1
1
<?php
2
3
namespace UCD\Unicode;
4
5
use UCD\Exception\InvalidArgumentException;
6
use UCD\Exception\UnexpectedValueException;
7
8
final class TransformationFormat implements Comparable
9
{
10
    const EIGHT = '8NE';
11
    const SIXTEEN = '16NE';
12
    const SIXTEEN_BIG_ENDIAN = '16BE';
13
    const SIXTEEN_LITTLE_ENDIAN = '16LE';
14
    const THIRTY_TWO = '32NE';
15
    const THIRTY_TWO_BIG_ENDIAN = '32BE';
16
    const THIRTY_TWO_LITTLE_ENDIAN = '32LE';
17
18
    /**
19
     * @var string[]
20
     */
21
    private static $valid = [
22
        self::EIGHT,
23
        self::SIXTEEN,
24
        self::SIXTEEN_BIG_ENDIAN,
25
        self::SIXTEEN_LITTLE_ENDIAN,
26
        self::THIRTY_TWO,
27
        self::THIRTY_TWO_BIG_ENDIAN,
28
        self::THIRTY_TWO_LITTLE_ENDIAN
29
    ];
30
31
    /**
32
     * @var string
33
     */
34
    private $type;
35
36
    /**
37
     * @param string $type
38
     * @throws InvalidArgumentException
39
     */
40
    private function __construct($type)
41
    {
42
        if (!in_array($type, self::$valid)) {
43
            throw new InvalidArgumentException();
44
        }
45
46
        $this->type = $type;
47
    }
48
49
    /**
50
     * @param string $type
51
     * @return TransformationFormat
52
     */
53
    public static function ofType($type)
54
    {
55
        return new self($type);
56
    }
57
58
    /**
59
     * @return string
60
     */
61
    public function getType()
62
    {
63
        return $this->type;
64
    }
65
66
    /**
67
     * @param mixed $other
68
     * @return bool
69
     */
70
    public function equals($other)
71
    {
72
        return $other instanceof self
73
            && $other->type === $this->type;
74
    }
75
}