Passed
Push — master ( 7ce3f4...5e32cd )
by for
14:35
created

EventBootstrap   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 10
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A bootstrap() 0 8 1
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