CollectionConstructorTrait::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
ccs 5
cts 5
cp 1
rs 9.4285
cc 2
eloc 3
nc 2
nop 1
crap 2
1
<?php
2
3
namespace Nayjest\Collection;
4
5
/**
6
 * Basic collection constructor implementation.
7
 */
8
trait CollectionConstructorTrait
9
{
10
    abstract public function set($items);
11
12
    /**
13
     * Constructor.
14
     *
15
     * @param array|null $items collection items
16
     */
17 32
    public function __construct(array $items = null)
18
    {
19 32
        if ($items !== null) {
20 32
            $this->set($items);
21 32
        }
22 32
    }
23
}
24