Completed
Pull Request — master (#81)
by
unknown
03:05
created

Controller   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 66
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 1
cbo 2
dl 0
loc 66
ccs 0
cts 15
cp 0
rs 10
1
<?php
2
3
namespace Zewa;
4
5
use Zewa\Interfaces\ContainerInterface;
6
7
use Zewa\Interfaces\ContainerInterface;
0 ignored issues
show
Bug introduced by
This code did not parse for me. Apparently, there is an error somewhere around this line:

Cannot use Zewa\Interfaces\ContainerInterface as ContainerInterface because the name is already in use
Loading history...
8
9
/**
10
 * Abstract class for controller extension
11
 *
12
 * @author Zechariah Walden<zech @ zewadesign.com>
13
 */
14
//can name spaces be removed in the classes extending..?
15
abstract class Controller
16
{
17
    /**
18
     * System configuration
19
     *
20
     * @var Config
21
     */
22
    protected $configuration;
23
24
    /**
25
     * Instantiated router class pointer
26
     *
27
     * @var Router
28
     */
29
    protected $router;
30
31
    /**
32
     * Instantiated request class pointer
33
     *
34
     * @var Request
35
     */
36
    protected $request;
37
38
    /**
39
     * League\Container
40
     *
41
     * @var DIContainer
42
     */
43
    protected $container;
44
45
    /**
46
     * Instantiated output class pointer
47
     *
48
     * @var object
49
     */
50
    protected $output;
51
52
    /**
53
     * @var View
54
     */
55
    protected $view;
56
57
    /**
58
     * Load up some basic configuration settings.
59
     */
60
    public function __construct()
61
    {
62
    }
63
64
    public function setView(View $view)
65
    {
66
        $this->view = $view;
67
        //@TODO instead of "getview" this needs to be "setResponse" -- set response should receive a view,
68
        //views probably don't need config, router, or request -- but they need access
69
        //to methods inside of there.
70
        // I'm not sure how I want to handle this yet.
71
//        return new View($this->configuration, $this->router, $this->request);
72
    }
73
74
    public function setConfig(Config $config)
75
    {
76
        $this->configuration = $config;
77
    }
78
79
    public function getConfig() : Config
80
    {
81
        return $this->configuration;
82
    }
83
84
    public function setRouter(Router $router)
85
    {
86
        $this->router = $router;
87
    }
88
89
    public function getRouter() : Router
90
    {
91
        return $this->router;
92
    }
93
94
    public function setRequest(Request $request)
95
    {
96
        $this->request = $request;
97
    }
98
99
    public function getRequest() : Request
100
    {
101
        return $this->request;
102
    }
103
104
    public function setContainer(DIContainer $container)
105
    {
106
        $this->container = $container;
107
    }
108
109
    public function getContainer() : DIContainer
110
    {
111
        return $this->container;
112
    }
113
}
114