Passed
Push — master ( 641929...562012 )
by Alexey
06:04 queued 12s
created

JsonUtil   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 7
c 1
b 0
f 0
dl 0
loc 14
ccs 0
cts 7
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A recursiveJson() 0 12 3
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * Copyright (c) Ne-Lexa
7
 *
8
 * For the full copyright and license information, please view
9
 * the LICENSE file that was distributed with this source code.
10
 *
11
 * @see https://github.com/Ne-Lexa/google-play-scraper
12
 */
13
14
namespace Nelexa\GPlay\Util;
15
16
class JsonUtil
17
{
18
    public static function recursiveJson($json, string $path = ''): string
19
    {
20
        if (\is_array($json)) {
21
            $return = '';
22
            foreach ($json as $key => $i) {
23
                $return .= self::recursiveJson($i, $path . '[' . $key . ']');
24
            }
25
26
            return $return;
27
        }
28
29
        return $path . ' => ' . $json . \PHP_EOL;
30
    }
31
}
32