Completed
Push — development ( daed94...13a157 )
by Thomas
18s
created

StructMapper   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 26
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A map() 0 16 2
1
<?php
2
3
namespace Oc\FieldNotes\Import;
4
5
use Oc\FieldNotes\Struct\FieldNote;
6
7
class StructMapper
8
{
9
    /**
10
     * Maps given array to field note struct.
11
     *
12
     * @param array $rows
13
     *
14
     * @return FieldNote[]
0 ignored issues
show
introduced by
FieldNote[] => \Oc\FieldNotes\Struct\FieldNote[]
Loading history...
15
     */
16
    public function map(array $rows)
17
    {
18
        $fieldNotes = [];
19
20
        foreach ($rows as $row) {
21
            $fieldNote = new FieldNote();
22
            $fieldNote->waypoint = $row[0];
23
            $fieldNote->noticedAt = $row[1];
24
            $fieldNote->logType = $row[2];
25
            $fieldNote->notice = $row[3];
26
27
            $fieldNotes[] = $fieldNote;
28
        }
29
30
        return $fieldNotes;
31
    }
32
}
33