Completed
Pull Request — dev (#11)
by
unknown
05:12 queued 01:17
created

AbstractControllerPlugin   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 4
c 2
b 0
f 0
lcom 0
cbo 1
dl 0
loc 64
ccs 8
cts 8
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A beforeControllerSelected() 0 6 1
A afterControllerSelected() 0 8 1
A beforeActionInvoked() 0 8 1
A afterActionInvoked() 0 9 1
1
<?php
2
3
namespace Vectorface\SnappyRouter\Plugin;
4
5
use Vectorface\SnappyRouter\Controller\AbstractController;
6
use Vectorface\SnappyRouter\Handler\AbstractHandler;
7
use Vectorface\SnappyRouter\Request\HttpRequest;
8
9
/**
10
 * The base class for all controller-based plugins.
11
 * @copyright Copyright (c) 2014, VectorFace, Inc.
12
 * @author Dan Bruce <[email protected]>
13
 */
14
abstract class AbstractControllerPlugin extends AbstractPlugin implements ControllerPluginInterface
15
{
16
    /**
17
     * Invoked before the handler decides which controller will be used.
18
     * @param AbstractHandler $handler The handler selected by the router.
19
     * @param HttpRequest $request The request to be handled.
20
     */
21 2
    public function beforeControllerSelected(
22
        AbstractHandler $handler,
23
        HttpRequest $request
24
    ) {
25
26 2
    }
27
28
    /**
29
     * Invoked after the router has decided which controller will be used.
30
     * @param AbstractHandler $handler The handler selected by the router.
31
     * @param HttpRequest $request The request to be handled.
32
     * @param AbstractController $controller The controller determined to be used.
33
     * @param string $action The name of the action that will be invoked.
34
     */
35 2
    public function afterControllerSelected(
36
        AbstractHandler $handler,
37
        HttpRequest $request,
38
        AbstractController $controller,
39
        $action
40
    ) {
41
42 2
    }
43
44
    /**
45
     * Invoked before the handler invokes the selected action.
46
     * @param AbstractHandler $handler The handler selected by the router.
47
     * @param HttpRequest $request The request to be handled.
48
     * @param AbstractController $controller The controller determined to be used.
49
     * @param string $action The name of the action that will be invoked.
50
     */
51 2
    public function beforeActionInvoked(
52
        AbstractHandler $handler,
53
        HttpRequest $request,
54
        AbstractController $controller,
55
        $action
56
    ) {
57
58 2
    }
59
60
    /**
61
     * Invoked after the handler invoked the selected action.
62
     * @param AbstractHandler $handler The handler selected by the router.
63
     * @param HttpRequest $request The request to be handled.
64
     * @param AbstractController $controller The controller determined to be used.
65
     * @param string $action The name of the action that will be invoked.
66
     * @param mixed $response The response from the controller action.
67
     */
68 1
    public function afterActionInvoked(
69
        AbstractHandler $handler,
70
        HttpRequest $request,
71
        AbstractController $controller,
72
        $action,
73
        $response
74
    ) {
75
76 1
    }
77
}
78