Completed
Push — master ( 9a1097...9d1cce )
by Nate
04:06
created

Collection   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 21
ccs 0
cts 11
cp 0
rs 10
c 0
b 0
f 0

1 Method

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