Conditions | 4 |
Paths | 4 |
Total Lines | 19 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
36 | 6 | public function formatArray(array $items, $items_per_row, $color = null) |
|
37 | { |
||
38 | 6 | $items_chunks = array_chunk($items, $items_per_row); |
|
39 | |||
40 | 6 | $ret = array(); |
|
41 | |||
42 | 6 | if ( isset($color) ) { |
|
43 | 3 | foreach ( $items_chunks as $item_chunk ) { |
|
44 | 3 | $ret[] = '<fg=' . $color . '>' . implode('</>, <fg=' . $color . '>', $item_chunk) . '</>'; |
|
45 | 3 | } |
|
46 | 3 | } |
|
47 | else { |
||
48 | 3 | foreach ( $items_chunks as $item_chunk ) { |
|
49 | 3 | $ret[] = implode(', ', $item_chunk); |
|
50 | 3 | } |
|
51 | } |
||
52 | |||
53 | 6 | return implode(',' . PHP_EOL, $ret); |
|
54 | } |
||
55 | |||
57 |