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:
2017-03-09 11:03:30 +00:00
parent 282788bd3e
commit e21a5a1840

View File

@@ -37,6 +37,11 @@ class route
* the backend. The objct can be put to null to disable the feature */
public $ratelimiter = null;
/// MAPPING ///
/** The matching route comparison
*/
public $mapRoute = null;
/// RENDERER PART ///
/** 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);
}
/** 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
* function is called.
* Ex. : $app->get('/hello/{name}', function ($name) {
@@ -441,6 +453,7 @@ class route
{
if ($this->debug)
echo "==> FOUND EQUAL !\n";
$this->mapRoute = $route;
try
{
$data = $function ();
@@ -480,6 +493,7 @@ class route
{
if ($this->debug)
echo "==> FOUND REGEX !\n";
$this->mapRoute = $route;
$params = array ();
$reflect = new ReflectionFunction ($function);
foreach ($reflect->getParameters() as $key=>$val)