| Conditions | 4 |
| Paths | 5 |
| Total Lines | 26 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | public function getSections($texts) |
||
| 15 | { |
||
| 16 | // Secion list ordered by preference |
||
| 17 | $sections = [ |
||
| 18 | 'Beskrivelse fra forlaget (lang)' => '', |
||
| 19 | 'Publisher\'s description (full)' => '', |
||
| 20 | 'Beskrivelse fra Forlagssentralen' => '', |
||
| 21 | 'Beskrivelse fra forlaget (kort)' => '', |
||
| 22 | 'Publisher\'s description (brief)' => '', |
||
| 23 | 'Innholdsfortegnelse' => '', |
||
| 24 | ]; |
||
| 25 | |||
| 26 | $next = ''; |
||
| 27 | foreach ($texts as $t) { |
||
| 28 | if ($next != '') { |
||
| 29 | $sections[$next] = $t; |
||
| 30 | $next = ''; |
||
| 31 | } |
||
| 32 | if (isset($sections[$t])) { |
||
| 33 | // It's a section heading |
||
| 34 | $next = $t; |
||
| 35 | } |
||
| 36 | } |
||
| 37 | |||
| 38 | return $sections; |
||
| 39 | } |
||
| 40 | |||
| 69 |