Skip to content

Instantly share code, notes, and snippets.

@m4rw3r
Created August 16, 2011 10:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save m4rw3r/1148820 to your computer and use it in GitHub Desktop.
Save m4rw3r/1148820 to your computer and use it in GitHub Desktop.
Code generated by Inject\Router\CompilingDynamic
<?php
array('GET' => function($url)
{
$matches = array();
if(isset($url[0]) && $url[0] == "/")
{
if(isset($url[1]) && $url[1] == "u" && isset($url[2]) && $url[2] == "s" && isset($url[3]) && $url[3] == "e" && isset($url[4]) && $url[4] == "r")
{
if(( ! isset($url[5])))
{
// +/user$+
return array(array(1), array());
}
if(stripos($url, "-profile/", 5) === 5 && preg_match('/\\/user\\-profile\\/(\\d+)$/', $url, $matches))
{
// +/user\-profile/(\d+)$+
return array(array(3), array());
}
if(preg_match('/\\/user(?:\\/(?<id>\\d+))?$/', $url, $matches))
{
// +/user(?:/(?<id>\d+))?$+
return array(array(2), array_intersect_key($matches, array (
'id' => 0,
)));
}
}
if(( ! isset($url[1])))
{
// +/$+
return array(array(0), array());
}
}
return false;
},
'POST' => function($url)
{
$matches = array();
return false;
},
'PUT' => function($url)
{
$matches = array();
return false;
},
'DELETE' => function($url)
{
$matches = array();
return false;
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment