Passed
Push — master ( 19edd7...304f15 )
by Sérgio
02:36
created

Map::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Sergiors\Pipeline;
4
5
/**
6
 * @author Sérgio Rafael Siqueira <[email protected]>
7
 */
8
final class Map
9
{
10
    /**
11
     * @var \Closure
12
     */
13
    private $fn;
14
15
    /**
16
     * @param \Closure $fn
17
     */
18 2
    public function __construct(\Closure $fn)
19
    {
20 2
        $this->fn = $fn;
21 2
    }
22
23
    /**
24
     * @param mixed $payload
25
     *
26
     * @return mixed
27
     */
28 2
    public function __invoke($payload)
29
    {
30 2
        return array_map($this->fn, $payload);
31
    }
32
}
33