@@ -27,6 +27,7 @@ class App
27
27
{
28
28
//Default Controller
29
29
protected $ controllerName = 'home ' ;
30
+ protected $ controllerNamespace = null ;
30
31
31
32
//Default Method
32
33
protected $ methodName = 'index ' ;
@@ -91,17 +92,16 @@ public function __construct($url = false)
91
92
*/
92
93
private function getMethod ()
93
94
{
94
- if (empty ($ this ->url [0 ])) {
95
+ if (empty ($ this ->url [1 ])) {
95
96
Debug::info ('No Method Specified ' );
96
97
return $ this ->methodName ;
97
98
}
98
- if (method_exists ($ this ->controllerNameFull , $ this ->url [0 ])) {
99
- Debug::log ("Modifying the method from $ this ->methodName to " . $ this ->url [0 ]);
100
- $ out = array_shift ($ this ->url );
101
- return strtolower ( $ out ) ;
99
+ if (method_exists ($ this ->controllerNamespace , $ this ->url [1 ])) {
100
+ Debug::log ("Modifying the method from $ this ->methodName to " . $ this ->url [1 ]);
101
+ $ this -> methodName = strtolower ($ this ->url [ 1 ] );
102
+ return $ this -> methodName ;
102
103
}
103
- Debug::info ('Method not found: ' . $ this ->url [0 ] . ', loading default. ' );
104
- array_shift ($ this ->url );
104
+ Debug::info ('Method not found: ' . $ this ->url [1 ] . ', loading default. ' );
105
105
return $ this ->methodName ;
106
106
}
107
107
@@ -161,16 +161,17 @@ private function getController()
161
161
private function updateController ()
162
162
{
163
163
Debug::log ("Modifying the controller from $ this ->controllerName to " . $ this ->url [0 ]);
164
+
164
165
}
165
-
166
+
166
167
/**
167
168
* This function Initiates the specified controller and
168
169
* stores it as an object in controllerObject.
169
170
*/
170
171
private function loadController ()
171
172
{
172
173
Debug::group ("Initiating controller: $ this ->controllerName " , 1 );
173
- $ this ->controllerObject = new $ this ->controllerNameFull ;
174
+ $ this ->controllerObject = new $ this ->controllerNamespace ;
174
175
Debug::gend ();
175
176
}
176
177
0 commit comments