Map   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 14
ccs 4
cts 4
cp 1
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A map() 0 7 2
1
<?php
2
3
namespace Cocur\Chain\Link;
4
5
/**
6
 * Map.
7
 *
8
 * @author    Florian Eckerstorfer
9
 * @copyright 2015-2018 Florian Eckerstorfer
10
 */
11
trait Map
12
{
13
    /**
14
     * @param callable $callback
15
     *
16
     * @return self
17
     */
18 2
    public function map(callable $callback): self
19
    {
20 2
        foreach ($this->array as $index => $element) {
21 2
            $this->array[$index] = $callback($element, $index);
22
        }
23
24 2
        return $this;
25
    }
26
}
27