| @@ 48-60 (lines=13) @@ | ||
| 45 | * @return string |
|
| 46 | * @throws \InvalidArgumentException |
|
| 47 | */ |
|
| 48 | public function formatListMarker(array $list): string |
|
| 49 | { |
|
| 50 | if (empty($list)) { |
|
| 51 | throw new \InvalidArgumentException('The list must contain at least one value'); |
|
| 52 | } |
|
| 53 | ||
| 54 | $output = "\n"; |
|
| 55 | foreach ($list as $value) { |
|
| 56 | $output .= "• " . $value . "\n"; |
|
| 57 | } |
|
| 58 | ||
| 59 | return $output; |
|
| 60 | } |
|
| 61 | ||
| 62 | /** |
|
| 63 | * @param array $list |
|
| @@ 67-80 (lines=14) @@ | ||
| 64 | * @return string |
|
| 65 | * @throws \InvalidArgumentException |
|
| 66 | */ |
|
| 67 | public function formatListNumeric(array $list): string |
|
| 68 | { |
|
| 69 | if (empty($list)) { |
|
| 70 | throw new \InvalidArgumentException('The list must contain at least one value'); |
|
| 71 | } |
|
| 72 | ||
| 73 | $n = 0; |
|
| 74 | $output = "\n"; |
|
| 75 | foreach ($list as $value) { |
|
| 76 | $output .= ++$n . ". " . $value . "\n"; |
|
| 77 | } |
|
| 78 | ||
| 79 | return $output; |
|
| 80 | } |
|
| 81 | ||
| 82 | /** |
|
| 83 | * @param array $lines |
|