Passed
Push — client_release/8/8.2 ( 523f15...fbad58 )
by Vitalii
09:04
created

get_buda_desc()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 4
rs 10
1
<?php
2
3
$buda_root = "../../buda_apps";
4
5
function get_buda_apps() {
6
    global $buda_root;
7
    $apps = [];
8
    $x = scandir($buda_root);
9
    foreach ($x as $app) {
10
        if ($app[0] == '.') continue;
11
        if (!is_dir("$buda_root/$app")) continue;
12
        $apps[] = $app;
13
    }
14
    return $apps;
15
}
16
17
function get_buda_variants($app_name) {
18
    global $buda_root;
19
    $x = [];
20
    $pcs = scandir("$buda_root/$app_name");
21
    foreach ($pcs as $pc) {
22
        if ($pc[0] == '.') continue;
23
        if ($pc == 'desc.json') continue;
24
        $x[] = $pc;
25
    }
26
    return $x;
27
}
28
29
function get_buda_desc($app) {
30
    global $buda_root;
31
    $path = "$buda_root/$app/desc.json";
32
    return json_decode(file_get_contents($path));
33
}
34
35
?>
36