IndexAction::run()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 5
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 8
ccs 0
cts 7
cp 0
crap 6
rs 10
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