Completed
Push — master ( ec1997...dcb85b )
by Edgar
10:53
created

SQLDataProvider::getTokens()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 12
ccs 8
cts 8
cp 1
rs 9.4285
c 0
b 0
f 0
nc 1
cc 1
eloc 8
nop 1
crap 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
    public function __construct($config = [])
23
    {
24
        parent::__construct($config);
25
26
        $this->query = new Query();
27 6
    }
28
29 6
    public function init()
30
    {
31 2
        if (Yii::$app->get('db', false) === null) {
32 2
            throw new InvalidConfigException("You must configure database to use this provider.");
33
        }
34 6
35
        parent::init();
36 6
    }
37
}
38