Skip to content

Commit 97dcb46

Browse files
committed
fix: protectDefinedRoutes()
Remove unneeded if condition. Fix exception message.
1 parent e6eaf71 commit 97dcb46

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

‎system/Router/AutoRouterImproved.php‎

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -186,17 +186,15 @@ public function getRoute(string $uri): array
186186

187187
private function protectDefinedRoutes(): void
188188
{
189-
if ($this->httpVerb !== 'cli') {
190-
$controller = strtolower($this->controller);
189+
$controller = strtolower($this->controller);
191190

192-
foreach ($this->protectedControllers as $controllerInRoutes) {
193-
$routeLowerCase = strtolower($controllerInRoutes);
191+
foreach ($this->protectedControllers as $controllerInRoutes) {
192+
$routeLowerCase = strtolower($controllerInRoutes);
194193

195-
if ($routeLowerCase === $controller) {
196-
throw new PageNotFoundException(
197-
'Cannot access CLI Route Handler: ' . $controllerInRoutes
198-
);
199-
}
194+
if ($routeLowerCase === $controller) {
195+
throw new PageNotFoundException(
196+
'Cannot access the controller in Defined Routes. Controller: ' . $controllerInRoutes
197+
);
200198
}
201199
}
202200
}

0 commit comments

Comments
 (0)