PreferenceCollection::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
c 0
b 0
f 0
rs 9.4285
cc 2
eloc 3
nc 2
nop 1
1
<?php namespace Anomaly\PreferencesModule\Preference;
2
3
use Anomaly\PreferencesModule\Preference\Contract\PreferenceInterface;
4
use Anomaly\Streams\Platform\Entry\EntryCollection;
5
6
/**
7
 * Class PreferenceCollection
8
 *
9
 * @link          http://pyrocms.com/
10
 * @author        PyroCMS, Inc. <[email protected]>
11
 * @author        Ryan Thompson <[email protected]>
12
 */
13
class PreferenceCollection extends EntryCollection
14
{
15
16
    /**
17
     * Create a new PreferenceCollection instance.
18
     *
19
     * @param array $items
20
     */
21
    public function __construct($items = [])
22
    {
23
        /* @var PreferenceInterface $item */
24
        foreach ($items as $item) {
25
            $this->items[$item->getKey()] = $item;
26
        }
27
    }
28
}
29