Passed
Push — master ( 475912...cb21e9 )
by Gabriel
04:32
created

BaseControllerWithEvents::invokeStageTest()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Nip\Controllers\Tests\Fixtures\Controllers;
4
5
use Nip\Controllers\Controller;
6
7
/**
8
 * Class BaseControllerWithEvents
9
 * @package Nip\Controllers\Tests\Fixtures
10
 */
11
class BaseControllerWithEvents extends Controller
12
{
13
    public $eventsTest = [];
14
15
    public function __construct()
16
    {
17
        parent:: __construct();
18
        $this->onParseRequest([$this, 'checkParseRequest']);
19
        $this->onParseRequest(function () {
20
            $this->eventsTest['parseRequest']++;
21
        });
22
    }
23
24
    public function invokeStageTest(string $stage)
25
    {
26
        $this->invokeStage($stage);
27
    }
28
29
    public function checkParseRequest()
30
    {
31
        $this->eventsTest['parseRequest'] = 1;
32
    }
33
34
    public function index()
35
    {
36
        return 'index';
37
    }
38
39
    /**
40
     * @return string
41
     */
42
    public function generateViewPath()
43
    {
44
        return dirname(__DIR__) . '/views';
45
    }
46
}
47