Skip to content

Commit 33b9d35

Browse files
committed
refactoring
removing controllerPath and indexPath
1 parent d39004d commit 33b9d35

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

App.php

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ class App
3131
//Default Method
3232
protected $methodName = 'index';
3333

34-
protected $controllerPath = null;
35-
protected $indexPath = null;
3634
protected $path = null;
3735
protected $directed = false;
3836
protected $params = [];
@@ -52,9 +50,8 @@ public function __construct($urlDirected = null)
5250
Debug::group('TPC Application');
5351
Debug::log("Class Initiated: " . __CLASS__);
5452

55-
// Set Default Controller Locations
56-
$this->controllerPath = Routes::getLocation('controllers')->folder;
57-
$this->indexPath = Routes::getFull();
53+
// Set Default Controller Location
54+
$this->path = Routes::getLocation('controllers')->folder;
5855

5956
// Set the application url to be used
6057
if (!empty($urlDirected)) {
@@ -128,34 +125,33 @@ private function getController()
128125
{
129126
if (empty($this->url[0])) {
130127
Debug::info('No Controller Specified.');
131-
$this->path = $this->controllerPath;
132128
return $this->controllerName;
133129
}
134130
if ($this->directed) {
135-
if (file_exists($this->indexPath . $this->url[0] . '.php')) {
131+
if (file_exists(Routes::getFull() . $this->url[0] . '.php')) {
136132
Debug::log("Modifying the controller from $this->controllerName to " . $this->url[0]);
137133
$out = array_shift($this->url);
138-
$this->path = $this->indexPath;
134+
$this->path = Routes::getFull();
139135
return strtolower($out);
140-
} elseif (file_exists($this->controllerPath . $this->url[0] . '.php')) {
136+
} elseif (file_exists($this->path . $this->url[0] . '.php')) {
141137
Debug::log("Modifying the controller from $this->controllerName to " . $this->url[0]);
142138
$out = array_shift($this->url);
143-
$this->path = $this->controllerPath;
144139
return strtolower($out);
145140
}
146141
}
147-
if (!$this->directed && file_exists($this->controllerPath . $this->url[0] . '.php')) {
142+
if (!$this->directed && file_exists($this->path . $this->url[0] . '.php')) {
148143
Debug::log("Modifying the controller from $this->controllerName to " . $this->url[0]);
149144
$out = array_shift($this->url);
150-
$this->path = $this->controllerPath;
151145
return strtolower($out);
152146
}
153147
Debug::info('Could not locate specified controller: ' . $this->url[0]);
154-
$this->path = $this->controllerPath;
155148
array_shift($this->url);
156149
return $this->controllerName;
157150
}
158-
151+
private function updateController()
152+
{
153+
Debug::log("Modifying the controller from $this->controllerName to " . $this->url[0]);
154+
}
159155
/**
160156
* This function Initiates the specified controller and
161157
* stores it as an object in controllerObject.

0 commit comments

Comments
 (0)