Passed
Pull Request — develop (#69)
by
unknown
01:26
created

ArrayHelper   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
dl 0
loc 19
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A arrayToTableRows() 0 11 3
1
<?php
2
3
namespace Nord\Lumen\Elasticsearch\Helpers;
4
5
/**
6
 * Class ReindexResponseTransformer
7
 * @package Nord\Lumen\Elasticsearch\Helpers
8
 */
9
class ArrayHelper
10
{
11
    /**
12
     * Transform response array to Symfony Table rows input
13
     * @param array $response
14
     *
15
     * @return array
16
     */
17
    public static function arrayToTableRows(array $response)
18
    {
19
        $rows = [];
20
        foreach ($response as $key => $value) {
21
            if(!is_array($value)) {
22
                $rows[] = [$key, $value];
23
            } else {
24
                $rows[] = [$key, implode(",", $value)];
25
            }
26
        }
27
        return $rows;
28
    }
29
}
30