Passed
Pull Request — master (#16)
by
unknown
06:23 queued 02:44
created

ExtraConfig::getExtraConfig()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 12
rs 10
c 0
b 0
f 0
cc 3
nc 2
nop 0
1
<?php
2
3
namespace DigitalOrigin\Pmt\Helper;
4
5
use Magento\Framework\App\ResourceConnection;
6
7
class ExtraConfig
8
{
9
    /** Config tablename */
10
    const CONFIG_TABLE = 'pmt_config';
11
12
    /** @var ResourceConnection $dbObject */
13
    protected $dbObject;
14
15
    /**
16
     * ExtraConfig constructor.
17
     *
18
     * @param ResourceConnection $resource
19
     */
20
    public function __construct(ResourceConnection $resource)
21
    {
22
        $this->dbObject = $resource;
23
    }
24
25
    /**
26
     * @return array
27
     */
28
    public function getExtraConfig()
29
    {
30
        $data = array();
31
        $dbConnection = $this->dbObject->getConnection();
32
        $result = $dbConnection->fetchAll("select * from ".self::CONFIG_TABLE);
33
        if (count($result)) {
34
            foreach ($result as $value) {
35
                $data[$value['config']] = $value['value'];
36
            }
37
        }
38
39
        return $data;
40
    }
41
}