Passed
Pull Request — master (#48)
by
unknown
02:20
created

WcPagantisExtraConfig::getExtraConfig()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 7
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 11
rs 10
1
<?php
2
3
4
5
class WcPagantisExtraConfig
6
{
7
8
    /** @var array $extraConfig */
9
    public $extraConfig;
10
11
12
13
    public static function getExtraConfigValue($key)
14
    {
15
        include_once('class-wc-pagantis-logger.php');
16
        $config = self::getExtraConfig();
17
        $value = $config[$key];
18
        return $value;
19
    }
20
21
    /**
22
     * @return array
23
     */
24
    public static function getExtraConfig()
25
    {
26
        global $wpdb;
27
        $tableName = $wpdb->prefix.PAGANTIS_CONFIG_TABLE;
28
        $response = array();
29
        $dbResult = $wpdb->get_results("select config, value from $tableName", ARRAY_A);
0 ignored issues
show
Bug introduced by
The constant ARRAY_A was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
30
        foreach ($dbResult as $value) {
31
            $response[$value['config']] = $value['value'];
32
        }
33
34
        return $response;
35
    }
36
}
37
38
39