| Conditions | 3 |
| Paths | 3 |
| Total Lines | 14 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 32 | */ |
||
| 33 | public function getColumns(string $line) : array |
||
| 34 | { |
||
| 35 | $columns = []; |
||
| 36 | |||
| 37 | $columnStart = 0; |
||
| 38 | $lastColumnIndex = count($this->columnWidths) - 1; |
||
| 39 | foreach ($this->columnWidths as $i => $columnWidth) { |
||
| 40 | $actualWidth = $i === $lastColumnIndex ? strlen($line) : $columnWidth; |
||
| 41 | $columns[] = trim(substr($line, $columnStart, $actualWidth)); |
||
| 42 | $columnStart += $actualWidth; |
||
| 43 | } |
||
| 44 | |||
| 45 | return $columns; |
||
| 46 | } |
||
| 48 |