Skip to content

Instantly share code, notes, and snippets.

@m4rw3r m4rw3r/gist:1148820
Created Aug 16, 2011

Embed
What would you like to do?
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
You can’t perform that action at this time.