Passed
Push — master ( 141183...2b56eb )
by Petr
08:03
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 1
Bugs 0 Features 1
Metric Value
cc 2
eloc 1
c 1
b 0
f 1
nc 2
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 2
rs 10
1
<?php
2
3
namespace kalanis\kw_auth\Sources;
4
5
6
use kalanis\kw_auth\Interfaces\IUser;
7
8
9
/**
10
 * Trait TStatusTransform
11
 * @package kalanis\kw_auth\Sources
12
 * Status - integer to string and back
13
 */
14
trait TStatusTransform
15
{
16 11
    protected function transformFromIntToString(?int $value): string
17
    {
18 11
        return is_null($value) ? IUser::STATUS_NONE : strval($value);
19
    }
20
21 21
    protected function transformFromStringToInt(string $value): ?int
22
    {
23 21
        return IUser::STATUS_NONE == $value ? null : intval($value);
24
    }
25
}
26