Code Duplication    Length = 26-26 lines in 2 locations

src/framework/mappers/RecordMapper.php 1 location

@@ 10-35 (lines=26) @@
7
/**
8
 * Use this Mapper for quick, on-demand record mapping - as an alternative to implementing an actual Mapper class.
9
 */
10
class RecordMapper implements Mapper
11
{
12
    /**
13
     * @var callable
14
     */
15
    private $mapper;
16
17
    /**
18
     * @param callable $mapper function (array $record_set) : array
19
     */
20
    public function __construct(callable $mapper)
21
    {
22
        $this->mapper = $mapper;
23
    }
24
25
    public function map(array $record_set)
26
    {
27
        $result = [];
28
29
        foreach ($record_set as $key => $record) {
30
            $result[$key] = call_user_func($this->mapper, $record);
31
        }
32
33
        return $result;
34
    }
35
}
36

src/framework/RecordMapper.php 1 location

@@ 8-33 (lines=26) @@
5
/**
6
 * Use this Mapper for quick, on-demand record mapping - as an alternative to implementing an actual Mapper class.
7
 */
8
class RecordMapper implements Mapper
9
{
10
    /**
11
     * @var callable
12
     */
13
    private $mapper;
14
15
    /**
16
     * @param callable $mapper function (array $record_set) : array
17
     */
18
    public function __construct(callable $mapper)
19
    {
20
        $this->mapper = $mapper;
21
    }
22
23
    public function map(array $record_set)
24
    {
25
        $result = [];
26
27
        foreach ($record_set as $key => $record) {
28
            $result[$key] = call_user_func($this->mapper, $record);
29
        }
30
31
        return $result;
32
    }
33
}
34