Completed
Push — master ( 198b3f...28f717 )
by Nate
02:18
created

Collection   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 27
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A transform() 0 17 2
1
<?php
2
3
/**
4
 * @package   Transform
5
 * @author    Flipbox Factory
6
 * @copyright Copyright (c) 2017, Flipbox Digital
7
 * @link      https://github.com/flipbox/transform/releases/latest
8
 * @license   https://github.com/flipbox/transform/blob/master/LICENSE
9
 */
10
11
namespace flipbox\transform\resources;
12
13
use ArrayIterator;
14
15
/**
16
 * @package flipbox\transform\resources
17
 * @author Flipbox Factory <[email protected]>
18
 * @since 1.0.0
19
 *
20
 * @property array|ArrayIterator $data
21
 */
22
class Collection extends Item
23
{
24
25
    /**
26
     * @param callable $transformer
27
     * @param $data
28
     * @return array|null
29
     */
30
    public function transform(callable $transformer, $data)
31
    {
32
33
        $items = [];
34
35
        foreach ($data as $item) {
36
37
            $items[] = parent::transform(
38
                $transformer,
39
                $item
40
            );
41
42
        }
43
44
        return $items;
45
46
    }
47
48
}
49