[TASK] Readded Pecee folder.

This commit is contained in:
Simon Sessingø
2015-11-02 08:08:49 +01:00
parent b400b86322
commit 3fc81b6492
15 changed files with 0 additions and 0 deletions
+43
View File
@@ -0,0 +1,43 @@
<?php
namespace Pecee\SimpleRouter;
use Pecee\Http\Request;
class RouterGroup extends RouterEntry {
public function __construct() {
parent::__construct();
}
public function renderRoute(Request $request) {
// Check if request method is allowed
if(trim($this->prefix) === '' || 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($request->getMethod(), $this->getRequestMethods()));
} else {
$hasAccess = strtolower($this->getRequestMethods()) == strtolower($request->getMethod());
}
}
if(!$hasAccess) {
throw new RouterException('Method not allowed');
}
return parent::renderRoute($request);
}
// No match here, move on...
return null;
}
public function matchRoute(Request $request) {
return null;
}
}