route : add the mapRoute function to know the matching route search comparison
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3392 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
14
route.php
14
route.php
@@ -37,6 +37,11 @@ class route
|
|||||||
* the backend. The objct can be put to null to disable the feature */
|
* the backend. The objct can be put to null to disable the feature */
|
||||||
public $ratelimiter = null;
|
public $ratelimiter = null;
|
||||||
|
|
||||||
|
/// MAPPING ///
|
||||||
|
/** The matching route comparison
|
||||||
|
*/
|
||||||
|
public $mapRoute = null;
|
||||||
|
|
||||||
/// RENDERER PART ///
|
/// RENDERER PART ///
|
||||||
/** Output type to no previous catched renderer (allow : json, xml, txt html)
|
/** Output type to no previous catched renderer (allow : json, xml, txt html)
|
||||||
*/
|
*/
|
||||||
@@ -304,6 +309,13 @@ class route
|
|||||||
throw new Exception ("Invalid REQUEST_METHOD", 406);
|
throw new Exception ("Invalid REQUEST_METHOD", 406);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Return the mached route search
|
||||||
|
*/
|
||||||
|
public function mapRoute ()
|
||||||
|
{
|
||||||
|
return $this->mapRoute;
|
||||||
|
}
|
||||||
|
|
||||||
/** If the URL is corresponding with $url, and the method is GET, then the
|
/** If the URL is corresponding with $url, and the method is GET, then the
|
||||||
* function is called.
|
* function is called.
|
||||||
* Ex. : $app->get('/hello/{name}', function ($name) {
|
* Ex. : $app->get('/hello/{name}', function ($name) {
|
||||||
@@ -441,6 +453,7 @@ class route
|
|||||||
{
|
{
|
||||||
if ($this->debug)
|
if ($this->debug)
|
||||||
echo "==> FOUND EQUAL !\n";
|
echo "==> FOUND EQUAL !\n";
|
||||||
|
$this->mapRoute = $route;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$data = $function ();
|
$data = $function ();
|
||||||
@@ -480,6 +493,7 @@ class route
|
|||||||
{
|
{
|
||||||
if ($this->debug)
|
if ($this->debug)
|
||||||
echo "==> FOUND REGEX !\n";
|
echo "==> FOUND REGEX !\n";
|
||||||
|
$this->mapRoute = $route;
|
||||||
$params = array ();
|
$params = array ();
|
||||||
$reflect = new ReflectionFunction ($function);
|
$reflect = new ReflectionFunction ($function);
|
||||||
foreach ($reflect->getParameters() as $key=>$val)
|
foreach ($reflect->getParameters() as $key=>$val)
|
||||||
|
|||||||
Reference in New Issue
Block a user