Completed
Pull Request — master (#126)
by
unknown
04:08
created

DeletedList   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 33
ccs 0
cts 14
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A processItems() 0 11 2
1
<?php
2
namespace Kunnu\Dropbox\Models;
3
4
class DeletedList extends ModelCollection
5
{
6
    /**
7
     * Create a new Metadata Collection
8
     *
9
     * @param array $data Collection Data
10
     */
11
    public function __construct(array $data)
12
    {
13
        $processedItems = $this->processItems($data);
14
        parent::__construct($processedItems);
15
    }
16
17
    /**
18
     * Process items and cast them
19
     * to DeletedMetadata Model
20
     *
21
     * @param array $items Unprocessed Items
22
     *
23
     * @return array Array of DeletedMetadata models
24
     */
25
    protected function processItems(array $items)
26
    {
27
        $processedEntries = [];
28
29
        foreach ($items as $item) {
30
            $item['metadata']['status'] = $item['.tag'];
31
            $processedEntries[] = new DeletedMetadata($item['metadata']);
32
        }
33
34
        return $processedEntries;
35
    }
36
}
37