Passed
Push — master ( 443842...86f0b2 )
by Joshua
05:55 queued 01:59
created

Collection::fromArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
ccs 0
cts 4
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace SeamsCMS\Delivery\Model;
5
6
abstract class Collection
7
{
8
    use HydratorTrait {
9
        fromArray as private fromArrayTrait;
10
    }
11
12
    /** @var array */
13
    protected $entries;
14
15
    /** @var CollectionMeta */
16
    protected $meta;
17
18
    /**
19
     * @return array
20
     */
21
    public function getEntries(): array
22
    {
23
        return $this->entries;
24
    }
25
26
    /**
27
     * @return CollectionMeta
28
     */
29
    public function getMeta(): CollectionMeta
30
    {
31
        return $this->meta;
32
    }
33
34
    public static function fromArray(array $data)
35
    {
36
        $data['meta'] = CollectionMeta::fromArray($data['meta']);
37
38
        return self::fromArrayTrait($data);
39
    }
40
}
41