CollectionConstructorTrait::set()
last analyzed

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 1
ccs 0
cts 0
cp 0
nc 1
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