Passed
Pull Request — master (#10)
by
unknown
14:43
created

EventBootstrap::bootstrap()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 8
rs 10
1
<?php
2
3
namespace app\core;
4
5
use app\core\behaviors\LoggerBehavior;
6
use yii\base\BootstrapInterface;
7
use yii\base\Controller;
8
use yii\base\Event;
9
use yii\web\Response;
10
11
class EventBootstrap implements BootstrapInterface
12
{
13
    public function bootstrap($app)
14
    {
15
        Event::on(Response::class, Response::EVENT_BEFORE_SEND, function ($event) {
16
            \Yii::createObject(LoggerBehavior::class)->beforeSend($event);
17
        });
18
19
        Event::on(Controller::class, Controller::EVENT_BEFORE_ACTION, function ($event) {
0 ignored issues
show
Unused Code introduced by
The parameter $event is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

19
        Event::on(Controller::class, Controller::EVENT_BEFORE_ACTION, function (/** @scrutinizer ignore-unused */ $event) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
20
            \Yii::createObject(LoggerBehavior::class)->beforeAction();
21
        });
22
    }
23
}
24