refactoring, added uri class.
This commit is contained in:
@@ -72,14 +72,6 @@ class Loader {
|
||||
{
|
||||
return require $path;
|
||||
}
|
||||
|
||||
// Even if we didn't find a matching file for the segment, we still want to
|
||||
// check for a "routes.php" file which could handle the root route and any
|
||||
// routes that are impossible to handle in an explicitly named file.
|
||||
if (file_exists($path = str_replace('.php', '/routes.php', $path)))
|
||||
{
|
||||
return require $path;
|
||||
}
|
||||
}
|
||||
|
||||
return array();
|
||||
@@ -99,7 +91,6 @@ class Loader {
|
||||
|
||||
$routes = array();
|
||||
|
||||
// First we will check for the base routes file in the application directory.
|
||||
if (file_exists($path = $this->base.'routes'.EXT))
|
||||
{
|
||||
$routes = array_merge($routes, require $path);
|
||||
|
||||
@@ -99,7 +99,10 @@ class Route {
|
||||
// route is delegating the responsibility for handling the request to a controller.
|
||||
elseif (is_array($this->callback))
|
||||
{
|
||||
$callback = Arr::first($this->callback, function($key, $value) {return $key == 'delegate' or $value instanceof Closure;});
|
||||
$callback = Arr::first($this->callback, function($key, $value)
|
||||
{
|
||||
return $key == 'delegate' or $value instanceof Closure;
|
||||
});
|
||||
|
||||
return ($callback instanceof Closure) ? call_user_func_array($callback, $this->parameters) : new Delegate($callback);
|
||||
}
|
||||
@@ -121,7 +124,12 @@ class Route {
|
||||
*/
|
||||
public function filters($name)
|
||||
{
|
||||
return (is_array($this->callback) and isset($this->callback[$name])) ? explode(', ', $this->callback[$name]) : array();
|
||||
if (is_array($this->callback) and isset($this->callback[$name]))
|
||||
{
|
||||
return explode(', ', $this->callback[$name]);
|
||||
}
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user