Passed
Push — master ( 141183...2b56eb )
by Petr
08:03
created

TStatusTransform   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 3
c 1
b 0
f 1
dl 0
loc 10
ccs 4
cts 4
cp 1
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A transformFromIntToString() 0 3 2
A transformFromStringToInt() 0 3 2
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