Conditions | 3 |
Paths | 3 |
Total Lines | 17 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 11 |
CRAP Score | 3 |
1 | <?php |
||
29 | 6 | public function parseLine($line) |
|
30 | { |
||
31 | 6 | $result = []; |
|
32 | 6 | $cursor = 0; |
|
33 | |||
34 | 6 | foreach ($this->structure as $field => $width) { |
|
35 | 6 | $fieldValue = trim(mb_substr($line, $cursor, $width)); |
|
36 | |||
37 | 6 | if ($fieldValue !== '') { |
|
38 | 6 | $result[$field] = $fieldValue; |
|
39 | 4 | } |
|
40 | |||
41 | 6 | $cursor += $width; |
|
42 | 4 | } |
|
43 | |||
44 | 6 | return $result; |
|
45 | } |
||
46 | |||
68 |