[BUGFIX] Improvements

- Fixed errors with getRoute method.
- Added Response and Request classes.
- Added CSRF stuff.
- Cleanup and bugfixes.
This commit is contained in:
Simon Sessingø
2015-10-18 17:36:06 +02:00
parent 0650e5ba93
commit b3b362a9e6
11 changed files with 272 additions and 90 deletions
+6 -4
View File
@@ -2,24 +2,26 @@
namespace Pecee\SimpleRouter;
use Pecee\Http\Request;
class RouterGroup extends RouterEntry {
public function __construct() {
parent::__construct();
}
public function matchRoute($requestMethod, $url) {
public function matchRoute(Request $request) {
// Check if request method is allowed
if(strtolower($url) == strtolower($this->prefix) || stripos($url, $this->prefix) === 0) {
if(strtolower($request->getUri()) == strtolower($this->prefix) || stripos($request->getUri(), $this->prefix) === 0) {
$hasAccess = (!$this->method);
if($this->method) {
if(is_array($this->method)) {
$hasAccess = (in_array($requestMethod, $this->method));
$hasAccess = (in_array($request->getMethod(), $this->method));
} else {
$hasAccess = strtolower($this->method) == strtolower($requestMethod);
$hasAccess = strtolower($this->method) == strtolower($request->getMethod());
}
}