Passed
Pull Request — master (#16)
by
unknown
03:24
created

ExtraConfig   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 11
dl 0
loc 33
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getExtraConfig() 0 12 3
A __construct() 0 3 1
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 \Zend_Db_Statement_Interface
27
     */
28
    public function getExtraConfig()
29
    {
30
        $dbConnection = $this->dbObject->getConnection();
31
        $result = $dbConnection->fetchAll("select * from ".self::CONFIG_TABLE);
32
        if (count($result)) {
33
            $data = array();
34
            foreach ($result as $value) {
35
                $data[$value['config']] = $value['value'];
36
            }
37
        }
38
39
        return $data;
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $data does not seem to be defined for all execution paths leading up to this point.
Loading history...
40
    }
41
}