Test Failed
Pull Request — master (#5)
by
unknown
03:10
created

strval()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 2
rs 10
1
<?php
2
3
namespace Seboettg\Collection\ArrayList;
4
5
final class Functions
6
{
7
8
    public static function strval($value): string {
9
        if (is_double($value)) {
10
            $str = \strval($value);
11
            if (strlen($str) == 1) {
12
                return sprintf("%1\$.1f",$value);
13
            }
14
            return \strval($value);
15
        }
16
        if (is_bool($value)) {
17
            return $value ? "true" : "false";
18
        }
19
        return "$value";
20
    }
21
}
22
23
function strval($value): string {
24
    return Functions::strval($value);
25
}
26