WithCastingMethods::castValueIn()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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