Passed
Push — master ( 4b3d26...06dcf5 )
by Enjoys
12:36 queued 13s
created

Helper   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 87.5%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 16
ccs 7
cts 8
cp 0.875
rs 10
wmc 5

2 Methods

Rating   Name   Duplication   Size   Complexity  
A scalarValueToString() 0 6 3
A castType() 0 6 2
1
<?php
2
3
declare(strict_types=1);
4
5
6
namespace Enjoys\Dotenv;
7
8
9
final class Helper
10
{
11 28
    public static function scalarValueToString(string|bool|int|float|null $value): string
12
    {
13 28
        if (gettype($value) === 'boolean') {
14 6
            return $value ? 'true' : 'false';
15
        }
16 25
        return (string)$value;
17
    }
18
19 12
    public static function castType(string|bool|int|float|null $value): string|bool|int|float|null
20
    {
21 12
        if (gettype($value) !== 'string') {
22
            return $value;
23
        }
24 12
        return (new ValueTypecasting($value))->getCastValue();
25
    }
26
}
27