DefaultController::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 4
1
<?php
2
/**
3
 * @link https://github.com/yiimaker/yii2-newsletter
4
 * @copyright Copyright (c) 2017 Yii Maker
5
 * @license BSD 3-Clause License
6
 */
7
8
namespace ymaker\newsletter\backend\controllers;
9
10
use yii\web\Controller;
11
use ymaker\newsletter\common\services\ServiceInterface;
12
13
/**
14
 * Default controller for backend newsletter module.
15
 * 
16
 * @author Vladimir Kuprienko <[email protected]>
17
 * @since 1.0
18
 */
19
class DefaultController extends Controller
20
{
21
    /**
22
     * @inheritdoc
23
     */
24
    public $defaultAction = 'list';
25
26
    /**
27
     * @var ServiceInterface
28
     */
29
    protected $_service;
30
31
32
    /**
33
     * @inheritdoc
34
     */
35
    public function __construct($id, $module, ServiceInterface $service, $config = [])
36
    {
37
        $this->_service = $service;
38
        parent::__construct($id, $module, $config);
39
    }
40
    
41
    /**
42
     * Renders clients list
43
     *
44
     * @return string
45
     */
46
    public function actionList()
47
    {
48
        return $this->render('list', [
49
            'dataProvider' => $this->_service->getDataProvider(),
50
        ]);
51
    }
52
}
53