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

TStatusTransform   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

2 Methods

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