Passed
Push — master ( ed3164...71916c )
by Petr
02:23
created

TStatusTransform::transformFromIntToString()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 1
nc 2
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace kalanis\kw_auth_sources\Traits;
4
5
6
use kalanis\kw_auth_sources\Interfaces\IUser;
7
8
9
/**
10
 * Trait TStatusTransform
11
 * @package kalanis\kw_auth_sources\Traits
12
 * Status - integer to string and back
13
 */
14
trait TStatusTransform
15
{
16 7
    protected function transformFromIntToString(?int $value): string
17
    {
18 7
        return is_null($value) ? IUser::STATUS_NONE : strval($value);
19
    }
20
21 16
    protected function transformFromStringToInt(string $value): ?int
22
    {
23 16
        return IUser::STATUS_NONE == $value ? null : intval($value);
24
    }
25
}
26