EViewAction   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 18
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 11 2
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * Date: 2017-12-07
5
 * Time: 03:12
6
 */
7
8
namespace MP\ExtendedApi;
9
10
use yii\base\Event;
11
use yii\rest\ViewAction;
12
13
/**
14
 * Class    EViewAction
15
 * @package MP\ExtendedApi
16
 * @author  Yarmaliuk Mikhail
17
 * @version 1.0
18
 */
19
class EViewAction extends ViewAction
20
{
21
    const EVENT_RUN_VIEW_ACTION = 'runAction';
22
23
    /**
24
     * @inheritdoc
25
     */
26
    public function run($id)
27
    {
28
        $event = new Event(['data' => $id]);
29
30
        $this->trigger(self::EVENT_RUN_VIEW_ACTION, $event);
31
32
        if (!empty($event->data['id'])) {
33
            $id = $event->data['id'];
34
        }
35
36
        return parent::run($id);
37
    }
38
}
39