Completed
Push — master ( 63793c...96fdaa )
by vistart
06:04
created

RestModule   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 0
cbo 3
dl 0
loc 10
ccs 0
cts 4
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A init() 0 5 1
1
<?php
2
3
/**
4
 *  _   __ __ _____ _____ ___  ____  _____
5
 * | | / // // ___//_  _//   ||  __||_   _|
6
 * | |/ // /(__  )  / / / /| || |     | |
7
 * |___//_//____/  /_/ /_/ |_||_|     |_|
8
 * @link http://vistart.name/
9
 * @copyright Copyright (c) 2016 vistart
10
 * @license http://vistart.name/license/
11
 */
12
13
namespace vistart\Models\components;
14
15
use Yii;
16
use yii\web\Response;
17
use vistart\Models\traits\RestModuleTrait;
18
19
/**
20
 * This abstract module is used for building RESTful API Module.
21
 * Usage:
22
 * 1. You should redefine the `$controllerNamespace`
23
 *
24
 * @version 2.0
25
 * @author vistart <[email protected]>
26
 */
27
abstract class RestModule extends \yii\base\Module
28
{
29
    use RestModuleTrait;
30
31
    public function init()
32
    {
33
        parent::init();
34
        Yii::$app->response->on(Response::EVENT_BEFORE_SEND, [$this, 'responseBeforeSend']);
35
    }
36
}
37