Test Failed
Push — 7.x ( bea7e1...2b11c5 )
by Adrien
08:51
created

SplEnumUnit   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 9
c 1
b 0
f 1
dl 0
loc 43
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __set_state() 0 7 1
A __debugInfo() 0 4 1
A __construct() 0 2 1
1
<?php
2
3
/**
4
 * Part of SplTypes package.
5
 *
6
 * (c) Adrien Loyant <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Ducks\Component\SplTypes;
15
16
/**
17
 * SplEnumBacked gives the ability to emulate and create backed enumeration objects natively in PHP.
18
 *
19
 * @psalm-api
20
 */
21
abstract class SplEnumUnit extends SplEnum implements
22
    SplEnumSingletonable,
23
    SplUnitEnum
24
{
25
    use SplUnitEnumTrait;
26
27
    /**
28
     * {@inheritdoc}
29
     */
30
    protected function __construct()
31
    {
32
    }
33
34
    /**
35
     * Instanciate an exported object.
36
     *
37
     * @param array<mixed,mixed> $properties
38
     *
39
     * @return SplUnitEnum
40
     *
41
     * @codeCoverageIgnore
42
     * @psalm-suppress UnsafeInstantiation
43
     */
44
    public static function __set_state(array $properties): SplUnitEnum
45
    {
46
        /** @var SplEnumUnit $object */
47
        $object = /** @scrutinizer ignore-call */ new static();
48
        $object->name = $properties['name'];
49
50
        return $object;
51
    }
52
53
    /**
54
     * Dumping object.
55
     *
56
     * @return array<string,string>
57
     *
58
     * @codeCoverageIgnore
59
     */
60
    public function __debugInfo(): array
61
    {
62
        return [
63
            'name' => $this->name,
64
        ];
65
    }
66
}
67