Completed
Push — master ( 022616...175363 )
by Alex
08:53
created

TestCommonApplication::actionViewResult()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 5
rs 10
c 1
b 0
f 0
1
<?php
2
namespace Mezon\Application\Tests;
3
4
use Mezon\Rest;
5
use Mezon\HtmlTemplate\HtmlTemplate;
6
use Mezon\Application\CommonApplication;
7
8
/**
9
 * Application for testing purposes.
10
 */
11
class TestCommonApplication extends CommonApplication
12
{
13
14
    /**
15
     * Constructor
16
     */
17
    function __construct()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
18
    {
19
        parent::__construct(new HtmlTemplate(__DIR__, 'index'));
20
    }
21
22
    function actionArrayResult(): array
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
23
    {
24
        return [
25
            'title' => 'Array result',
26
            'main' => 'Route main'
27
        ];
28
    }
29
30
    function actionViewResult(): array
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
31
    {
32
        return [
33
            'title' => 'View result',
34
            'main' => new TestView('Test view result')
35
        ];
36
    }
37
38
    function actionInvalid(): string
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
39
    {
40
        return 'Invalid';
41
    }
42
43
    function actionRest(): array
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
44
    {
45
        throw (new Rest\Exception('exception', - 1, 502, 'body'));
46
    }
47
48
    function redirectTo($url): void
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
49
    {
50
        // do nothing
51
    }
52
53
    public $hasMessages = true;
54
55
    protected function getClassPath(): string
56
    {
57
        if ($this->hasMessages) {
58
            return parent::getClassPath();
59
        } else {
60
            return './unexisting-path';
61
        }
62
    }
63
}
64