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

BaseControllerWithEvents   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A checkParseRequest() 0 3 1
A invokeStageTest() 0 3 1
A __construct() 0 6 1
A generateViewPath() 0 3 1
A index() 0 3 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