SQLDataProvider   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
lcom 0
cbo 4
dl 0
loc 24
ccs 9
cts 9
cp 1
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 8 2
A __construct() 0 6 1
1
<?php
2
namespace nstdio\yii2notymo\provider;
3
4
use Yii;
5
use yii\base\InvalidConfigException;
6
use yii\db\Query;
7
8
/**
9
 * Class SQLDataProvider
10
 *
11
 * @package nstdio\notymo
12
 * @author  Edgar Asatryan <[email protected]>
13
 */
14
class SQLDataProvider extends DataProvider
15
{
16
    /**
17
     * DataProvider constructor.
18
     *
19
     * @param array $config
20
     *
21
     */
22 6
    public function __construct($config = [])
23
    {
24 6
        parent::__construct($config);
25
26 2
        $this->query = new Query();
27 2
    }
28
29 6
    public function init()
30
    {
31 6
        if (Yii::$app->get('db', false) === null) {
32 1
            throw new InvalidConfigException("You must configure database to use this provider.");
33
        }
34
35 5
        parent::init();
36 2
    }
37
}
38