Passed
Push — version-4 ( 195886...25fa49 )
by Sebastian
02:10
created

Functions::strval()   A

Complexity

Conditions 5
Paths 5

Size

Total Lines 13
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 5

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 5
eloc 8
c 1
b 0
f 0
nc 5
nop 1
dl 0
loc 13
ccs 9
cts 9
cp 1
crap 5
rs 9.6111

2 Methods

Rating   Name   Duplication   Size   Complexity  
A Functions.php$0 ➔ listOf() 0 3 1
Functions::listOf() 0 3 ?
1
<?php
2
3
namespace Seboettg\Collection\Lists;
4
5
use Seboettg\Collection\Comparable\Comparable;
6
7
final class Functions
8
{
9
    final public static function emptyList(): ListInterface
10
    {
11
        return new class() implements ListInterface {
12
            private $array = [];
0 ignored issues
show
Coding Style introduced by
Private member variable "array" must contain a leading underscore
Loading history...
introduced by
The private property $array is not used, and could be removed.
Loading history...
13
            use ArrayListTrait;
14
        };
15
    }
16
17 54
    final public static function listOf(...$elements): ListInterface
18
    {
19 54
        return listFromArray($elements);
20
    }
21
22 55
    final public static function listFromArray($elements): ListInterface
23
    {
24 55
        $list = emptyList();
25 55
        $list->setArray(array_values($elements));
26 55
        return $list;
27
    }
28
}
29
30
function emptyList(): ListInterface
31
{
32 63
    return Functions::emptyList();
33
}
34
35
function listOf(...$elements): ListInterface
36
{
37 54
    return Functions::listOf(...$elements);
38
}
39
40
function listFromArray(array $elements): ListInterface
41
{
42 55
    return Functions::listFromArray($elements);
43
}
44