SplStringEnum::__invoke()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 2
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
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
 * SplStringEnum gives the ability to emulate and create int enumeration objects natively in PHP.
18
 *
19
 * @extends SplEnumBacked<string>
20
 *
21
 * @psalm-api
22
 */
23
abstract class SplStringEnum extends SplEnumBacked
24
{
25
    /**
26
     * Value of enum instance.
27
     *
28
     * @var string
29
     */
30
    protected string $value;
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    final protected function __construct()
36
    {
37
        $this->__default = '';
38
39
        parent::__construct();
40
    }
41
42
    /**
43
     * Method called when a script tries to call an object as a function.
44
     *
45
     * @return string
46
     *
47
     * @psalm-suppress MixedInferredReturnType
48
     */
49
    final public function &__invoke(): string
50
    {
51
        return $this->__default;
52
    }
53
}
54