IndexAction   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 7
c 0
b 0
f 0
dl 0
loc 22
ccs 0
cts 7
cp 0
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 8 2
1
<?php
2
/**
3
 * @copyright Copyright(c) 2016 Webtools Ltd
4
 * @copyright Copyright(c) 2018 Thamtech, LLC
5
 * @link https://github.com/thamtech/yii2-scheduler
6
 * @license https://opensource.org/licenses/MIT
7
**/
8
9
namespace thamtech\scheduler\actions;
10
11
use Yii;
12
use yii\base\Action;
13
use thamtech\scheduler\models\SchedulerTask;
14
15
/**
16
 * List the task instances that have been established in the database.
17
 */
18
class IndexAction extends Action
19
{
20
    /**
21
     * @var string the view file to be rendered. If not set, it will take the value of [[id]].
22
     * That means, if you name the action as "index" in "SchedulerController", then the view name
23
     * would be "index", and the corresponding view file would be "views/scheduler/index.php".
24
     */
25
    public $view;
26
27
    /**
28
     * Runs the action
29
     *
30
     * @return string result content
31
     */
32
    public function run()
33
    {
34
        $model  = new SchedulerTask();
35
        $dataProvider = $model->search($_GET);
36
37
        return $this->controller->render($this->view ?: $this->id, [
38
            'dataProvider' => $dataProvider,
39
            'model' => $model,
40
        ]);
41
    }
42
}
43