Skip to content

Commit 77504f4

Browse files
authored
Merge pull request #14 from solleer/patch-7
Fix issue where the directories were not found correctly
2 parents 6e3b120 + 6ea830c commit 77504f4

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

ModuleJson.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,20 @@ public function find(array $route) {
2929
$matchedRoute = $config[$method][$routeName];
3030

3131
// This allows POST to inherit from GET if "inherit" : "GET" is set (or vice versa)
32-
if (isset($matchedRoute['inherit']) && isset($config[$matchedRoute->inherit][$routeName])) {
32+
if (isset($matchedRoute['inherit']) && isset($config[$matchedRoute['inherit']][$routeName])) {
3333
$inheritMethod = $matchedRoute['inherit'];
34-
$matchedRoute = array_merge($config[$inheritMethod[$routeName]], $matchedRoute);
34+
$matchedRoute = array_merge($config[$inheritMethod][$routeName], $matchedRoute);
3535
}
3636
}
37+
else return false;
3738

3839
return $this->getRoute($matchedRoute, $route);
3940
}
4041

4142
private function getRouteDir($moduleName) {
4243
$files = glob($this->moduleDir . '/*');
4344
$match = preg_grep('/' . $this->moduleDir . '\/' . $moduleName . '/i', $files);
44-
return $match[0] ?? false;
45+
return array_values($match)[0] ?? false;
4546
}
4647

4748
public function getConfig($route) {

0 commit comments

Comments
 (0)