Completed
Push — master ( 5fca22...233410 )
by Emily
01:43
created

MapTransformation   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 5 1
1
<?php
2
/**
3
 * This file is part of the Composite Utils package.
4
 *
5
 * (c) Emily Shepherd <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the
8
 * LICENSE.md file that was distributed with this source code.
9
 *
10
 * @package spaark/composite-utils
11
 * @author Emily Shepherd <[email protected]>
12
 * @license MIT
13
 */
14
15
namespace Spaark\CompositeUtils\Model\Collection\Transformation;
16
17
/**
18
 * A MapTransformation runs each element in an iterable collection
19
 * through a callback, and replaces that element with the result of that
20
 * call
21
 */
22
class MapTransformation extends CallbackTransformation
23
{
24
    /**
25
     * Processes the current value by running it through the callback
26
     */
27 1
    protected function process()
28
    {
29 1
        $this->key = $this->iterator->key();
30 1
        $this->current = $this->call();
31 1
    }
32
}
33