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

Test::sql_select()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
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