Passed
Push — master ( 19f46e...73ce88 )
by Mr
02:06
created

Test   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 5
dl 0
loc 32
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A sql_update() 0 5 1
A sql_delete() 0 3 1
A sql_insert() 0 3 1
A __construct() 0 6 1
A sql_select() 0 3 1
1
<?php
2
3
namespace DrMVC\Models;
4
5
use DrMVC\Config;
6
use DrMVC\Config\ConfigInterface;
7
use DrMVC\Database\Model;
8
9
class Test extends Model
10
{
11
    protected $collection = 'test';
12
13
    public function __construct(ConfigInterface $config = null)
14
    {
15
        // Unfortunately this part yet is not ready, so you can use temporary solution
16
        $config = new Config();
17
        $config->load(__DIR__ . '/database.php', 'database');
18
        parent::__construct($config);
19
    }
20
21
    public function sql_select()
22
    {
23
        return $this->select('SELECT * FROM prefix_test');
24
    }
25
26
    public function sql_insert(array $data = ['key' => 'value', 'key2' => 'value2'])
27
    {
28
        return $this->insert($data);
29
    }
30
31
    public function sql_update(int $id)
32
    {
33
        $data = ['key' => 'value', 'key2' => 'value2'];
34
        $where = ['id' => $id];
35
        return $this->update($data, $where);
36
    }
37
38
    public function sql_delete(array $data)
39
    {
40
        return $this->delete($data);
41
    }
42
}
43