Passed
Push — feature/0.7.0 ( 49f0a6...c2b907 )
by Ryuichi
44:54
created

Test1Controller::test8()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
namespace WebStream\Test\Controller;
3
4
use WebStream\Core\CoreController;
5
use WebStream\Annotation\Attributes\Alias;
6
use WebStream\Annotation\Attributes\ExceptionHandler;
7
use WebStream\Annotation\Attributes\Filter;
8
use WebStream\Annotation\Attributes\Header;
9
use WebStream\Annotation\Attributes\Template;
10
use WebStream\Annotation\Attributes\Validate;
11
use WebStream\Annotation\Attributes\Custom\CustomControllerAnnotation;
12
use WebStream\Exception\Extend\ForbiddenAccessException;
13
14
class Test1Controller extends CoreController
15
{
16
    /**
17
     * @Filter(type="before")
18
     */
19
    public function before()
20
    {
21
        echo "b1";
22
    }
23
24
    /**
25
     * @Filter(type="after")
26
     */
27
    public function after()
28
    {
29
        echo "a1";
30
    }
31
32
    /**
33
     * @Template("test1.tmpl")
34
     */
35
    public function test1()
36
    {
37
        $this->Test1->test1();
0 ignored issues
show
Bug introduced by
The method test1() does not exist on null. ( Ignorable by Annotation )

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

37
        $this->Test1->/** @scrutinizer ignore-call */ 
38
                      test1();

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
Bug Best Practice introduced by
The property Test1 does not exist on WebStream\Test\Controller\Test1Controller. Since you implemented __get, consider adding a @property annotation.
Loading history...
38
    }
39
40
    public function test2()
41
    {
42
        $this->Test1->test2();
0 ignored issues
show
Bug Best Practice introduced by
The property Test1 does not exist on WebStream\Test\Controller\Test1Controller. Since you implemented __get, consider adding a @property annotation.
Loading history...
43
    }
44
45
    /**
46
     * @Header(allowMethod="post")
47
     */
48
    public function test3()
49
    {
50
    }
51
52
    public function test4()
53
    {
54
        throw new ForbiddenAccessException("error");
55
    }
56
57
    /**
58
     * @ExceptionHandler("WebStream\Exception\Extend\ForbiddenAccessException")
59
     */
60
    public function test4Error($params)
61
    {
62
        echo $params['method'];
63
    }
64
65
    /**
66
     * @Alias(name="test5")
67
     */
68
    public function test5Alias()
69
    {
70
        echo "t5";
71
    }
72
73
    /**
74
     * @Validate(key="test", rule="required", method="get")
75
     */
76
    public function test6()
77
    {
78
        echo "t6";
79
    }
80
81
    /**
82
     * @Validate(key="test", rule="length[3]")
83
     */
84
    public function test7()
85
    {
86
        echo "t7";
87
    }
88
89
    /**
90
     * @Validate(key="test", rule="regexp[/\d+/]")
91
     */
92
    public function test8()
93
    {
94
        echo "t8";
95
    }
96
97
    /**
98
     * @CustomControllerAnnotation(name="t10")
99
     */
100
    public function test10()
101
    {
102
        echo $this->annotation[CustomControllerAnnotation::class][0]['name'];
103
    }
104
}
105