Skip to content

Instantly share code, notes, and snippets.

@fredemmott
Created December 5, 2019 21:01
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 fredemmott/38865631ec219f2643d94f33d1af7aaf to your computer and use it in GitHub Desktop.
Save fredemmott/38865631ec219f2643d94f33d1af7aaf to your computer and use it in GitHub Desktop.
dict(1) {
["GET"]=>
object(Facebook\HackRouter\PrefixMatching\PrefixMap) (3) {
["literals":"Facebook\HackRouter\PrefixMatching\PrefixMap":private]=>
dict(3) {
["/"]=>
string(18) "HomePageController"
["/robots.txt"]=>
string(19) "RobotsTxtController"
["/search"]=>
string(16) "SearchController"
}
["prefixes":"Facebook\HackRouter\PrefixMatching\PrefixMap":private]=>
dict(1) {
["/"]=>
object(Facebook\HackRouter\PrefixMatching\PrefixMap) (3) {
["literals":"Facebook\HackRouter\PrefixMatching\PrefixMap":private]=>
dict(0) {
}
["prefixes":"Facebook\HackRouter\PrefixMatching\PrefixMap":private]=>
dict(3) {
["j/"]=>
object(Facebook\HackRouter\PrefixMatching\PrefixMap) (3) {
["literals":"Facebook\HackRouter\PrefixMatching\PrefixMap":private]=>
dict(0) {
}
["prefixes":"Facebook\HackRouter\PrefixMatching\PrefixMap":private]=>
dict(0) {
}
["regexps":"Facebook\HackRouter\PrefixMatching\PrefixMap":private]=>
dict(1) {
["(?<Keyword>[^/]+)"]=>
object(Facebook\HackRouter\PrefixMatching\PrefixMapOrResponder) (2) {
["map":"Facebook\HackRouter\PrefixMatching\PrefixMapOrResponder":private]=>
NULL
["responder":"Facebook\HackRouter\PrefixMatching\PrefixMapOrResponder":private]=>
string(14) "JumpController"
}
}
}
["ma"]=>
object(Facebook\HackRouter\PrefixMatching\PrefixMap) (3) {
["literals":"Facebook\HackRouter\PrefixMatching\PrefixMap":private]=>
dict(0) {
}
["prefixes":"Facebook\HackRouter\PrefixMatching\PrefixMap":private]=>
dict(1) {
["nual/en/"]=>
object(Facebook\HackRouter\PrefixMatching\PrefixMap) (3) {
["literals":"Facebook\HackRouter\PrefixMatching\PrefixMap":private]=>
dict(0) {
}
["prefixes":"Facebook\HackRouter\PrefixMatching\PrefixMap":private]=>
dict(0) {
}
["regexps":"Facebook\HackRouter\PrefixMatching\PrefixMap":private]=>
dict(1) {
["(?<LegacyId>[^/]+)\.php"]=>
object(Facebook\HackRouter\PrefixMatching\PrefixMapOrResponder) (2) {
["map":"Facebook\HackRouter\PrefixMatching\PrefixMapOrResponder":private]=>
NULL
["responder":"Facebook\HackRouter\PrefixMatching\PrefixMapOrResponder":private]=>
string(24) "LegacyRedirectController"
}
}
}
}
["regexps":"Facebook\HackRouter\PrefixMatching\PrefixMap":private]=>
dict(0) {
}
}
["s/"]=>
object(Facebook\HackRouter\PrefixMatching\PrefixMap) (3) {
["literals":"Facebook\HackRouter\PrefixMatching\PrefixMap":private]=>
dict(0) {
}
["prefixes":"Facebook\HackRouter\PrefixMatching\PrefixMap":private]=>
dict(0) {
}
["regexps":"Facebook\HackRouter\PrefixMatching\PrefixMap":private]=>
dict(1) {
["(?<Checksum>[^/]+)/(?<File>.+)"]=>
object(Facebook\HackRouter\PrefixMatching\PrefixMapOrResponder) (2) {
["map":"Facebook\HackRouter\PrefixMatching\PrefixMapOrResponder":private]=>
NULL
["responder":"Facebook\HackRouter\PrefixMatching\PrefixMapOrResponder":private]=>
string(25) "StaticResourcesController"
}
}
}
}
["regexps":"Facebook\HackRouter\PrefixMatching\PrefixMap":private]=>
dict(7) {
["(?<Product>(?:hack|hsl))/reference/(?<Type>(?:class|trait|interface|function))/(?<Name>[^/]+)/"]=>
object(Facebook\HackRouter\PrefixMatching\PrefixMapOrResponder) (2) {
["map":"Facebook\HackRouter\PrefixMatching\PrefixMapOrResponder":private]=>
NULL
["responder":"Facebook\HackRouter\PrefixMatching\PrefixMapOrResponder":private]=>
string(22) "APIClassPageController"
}
["(?<Product>(?:hack|hsl))/reference/"]=>
object(Facebook\HackRouter\PrefixMatching\PrefixMapOrResponder) (2) {
["map":"Facebook\HackRouter\PrefixMatching\PrefixMapOrResponder":private]=>
NULL
["responder":"Facebook\HackRouter\PrefixMatching\PrefixMapOrResponder":private]=>
string(21) "APIFullListController"
}
["(?<Product>(?:hack|hsl))/reference/(?<Type>(?:class|trait|interface|function))/"]=>
object(Facebook\HackRouter\PrefixMatching\PrefixMapOrResponder) (2) {
["map":"Facebook\HackRouter\PrefixMatching\PrefixMapOrResponder":private]=>
NULL
["responder":"Facebook\HackRouter\PrefixMatching\PrefixMapOrResponder":private]=>
string(23) "APIListByTypeController"
}
["(?<Product>(?:hack|hsl))/reference/(?<Type>(?:class|trait|interface|function))/(?<Class>[^/]+)/(?<Method>[^/]+)/"]=>
object(Facebook\HackRouter\PrefixMatching\PrefixMapOrResponder) (2) {
["map":"Facebook\HackRouter\PrefixMatching\PrefixMapOrResponder":private]=>
NULL
["responder":"Facebook\HackRouter\PrefixMatching\PrefixMapOrResponder":private]=>
string(23) "APIMethodPageController"
}
["(?<Product>(?:hhvm|hack))/(?<Guide>[^/]+)/(?<Page>[^/]+)"]=>
object(Facebook\HackRouter\PrefixMatching\PrefixMapOrResponder) (2) {
["map":"Facebook\HackRouter\PrefixMatching\PrefixMapOrResponder":private]=>
NULL
["responder":"Facebook\HackRouter\PrefixMatching\PrefixMapOrResponder":private]=>
string(19) "GuidePageController"
}
["(?<Product>(?:hhvm|hack))/"]=>
object(Facebook\HackRouter\PrefixMatching\PrefixMapOrResponder) (2) {
["map":"Facebook\HackRouter\PrefixMatching\PrefixMapOrResponder":private]=>
NULL
["responder":"Facebook\HackRouter\PrefixMatching\PrefixMapOrResponder":private]=>
string(20) "GuidesListController"
}
["(?<Product>(?:hhvm|hack))/(?<Guide>[^/]+)/"]=>
object(Facebook\HackRouter\PrefixMatching\PrefixMapOrResponder) (2) {
["map":"Facebook\HackRouter\PrefixMatching\PrefixMapOrResponder":private]=>
NULL
["responder":"Facebook\HackRouter\PrefixMatching\PrefixMapOrResponder":private]=>
string(34) "RedirectToGuideFirstPageController"
}
}
}
}
["regexps":"Facebook\HackRouter\PrefixMatching\PrefixMap":private]=>
dict(0) {
}
}
}
$map = ImmMap {
\Facebook\HackRouter\HttpMethod::GET => ImmMap {
'/{Product:(?:hack|hsl)}/reference/{Type:(?:class|trait|interface|function)}/{Name}/' =>
\APIClassPageController::class,
'/{Product:(?:hack|hsl)}/reference/' => \APIFullListController::class,
'/{Product:(?:hack|hsl)}/reference/{Type:(?:class|trait|interface|function)}/' =>
\APIListByTypeController::class,
'/{Product:(?:hack|hsl)}/reference/{Type:(?:class|trait|interface|function)}/{Class}/{Method}/' =>
\APIMethodPageController::class,
'/{Product:(?:hhvm|hack)}/{Guide}/{Page}' => \GuidePageController::class,
'/{Product:(?:hhvm|hack)}/' => \GuidesListController::class,
'/' => \HomePageController::class,
'/j/{Keyword}' => \JumpController::class,
'/manual/en/{LegacyId}.php' => \LegacyRedirectController::class,
'/{Product:(?:hhvm|hack)}/{Guide}/' =>
\RedirectToGuideFirstPageController::class,
'/robots.txt' => \RobotsTxtController::class,
'/search' => \SearchController::class,
'/s/{Checksum}/{File:.+}' => \StaticResourcesController::class,
},
};
@Capsulegg123
Copy link

How to use this code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment