Passed
Push — dpa_warnings3 ( 07faf2...85d2bf )
by David
19:22 queued 09:32
created

get_buda_variants()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 10
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
eloc 8
c 1
b 0
f 0
nc 4
nop 1
dl 0
loc 10
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