Updated documentation

This commit is contained in:
Simon Sessingø
2016-11-15 03:55:28 +01:00
parent d5e7a13d89
commit bc14790a67
2 changed files with 11 additions and 6 deletions
+8 -3
View File
@@ -49,12 +49,17 @@ This is an example of a basic ```index.php``` file:
```php ```php
use \Pecee\SimpleRouter\SimpleRouter; use \Pecee\SimpleRouter\SimpleRouter;
require_once 'routes.php'; // change this to whatever makes sense in your project // Load external routes file
require_once 'routes.php';
/*
* The default namespace for route-callbacks, so we don't have to specify it each time.
* Can be overwritten by using the namespace config option.
*/
// The apps default namespace (so we don't have to specify it each time we use MyController@home)
SimpleRouter::setDefaultNamespace('MyWebsite\Controller'); SimpleRouter::setDefaultNamespace('MyWebsite\Controller');
// Do the routing // Start the routing
SimpleRouter::start(); SimpleRouter::start();
``` ```
+3 -3
View File
@@ -106,7 +106,6 @@ class RouterBase {
$mergedSettings = array(); $mergedSettings = array();
/* @var $route RouterEntry */ /* @var $route RouterEntry */
/* @var $group RouterGroup */
for($i = 0; $i < count($routes); $i++) { for($i = 0; $i < count($routes); $i++) {
$route = $routes[$i]; $route = $routes[$i];
@@ -148,6 +147,7 @@ class RouterBase {
if ($route->matchRoute($this->request)) { if ($route->matchRoute($this->request)) {
/* @var $group RouterGroup */
$group = $route; $group = $route;
$mergedSettings = array_merge($settings, $group->getMergeableSettings()); $mergedSettings = array_merge($settings, $group->getMergeableSettings());
@@ -214,11 +214,11 @@ class RouterBase {
$routeNotAllowed = false; $routeNotAllowed = false;
$this->request->rewrite_uri = $this->request->uri; $this->request->rewrite_uri = $this->request->getUri();
$this->request->setUri($originalUri); $this->request->setUri($originalUri);
$this->request->loadedRoute = $route; $this->request->loadedRoute = $route;
$route->loadMiddleware($this->request); $this->request->loadedRoute->loadMiddleware($this->request);
$this->request->loadedRoute->renderRoute($this->request); $this->request->loadedRoute->renderRoute($this->request);