WithCastingMethods::castValueOut()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
declare(strict_types=1);
3
4
namespace JDecool\Test\Doctrine\Enum;
5
6
use MabeEnum\Enum;
7
use function str_replace;
8
use function strtolower;
9
use function strtoupper;
10
11
/**
12
 * Class WithCastingMethods
13
 * @author
14
 * @link
15
 *
16
 * @method static WithCastingMethods FOO()
17
 * @method static WithCastingMethods BAR()
18
 */
19
class WithCastingMethods extends Enum
20
{
21
    public const FOO = 'foo_value';
22
    public const BAR = 'bar_value';
23
24
    public static function castValueIn($value)
25
    {
26
        return strtolower(str_replace(' ', '_', $value));
27
    }
28
29
    public static function castValueOut(self $value)
30
    {
31
        return strtoupper(str_replace('_', ' ', $value->getValue()));
32
    }
33
}
34