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

MapTransformation::process()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
crap 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