in src/Codegen.hack [177:220]
private function buildUriBuilders(): void {
$config = Shapes::idx($this->config, 'uriBuilders');
if ($config === null) {
return;
}
$base = $config['baseClass'] ?? UriBuilderCodegen::class;
$param_builder = $config['parameterCodegenBuilder']
?? new RequestParameterCodegenBuilder($this->getHackCodegenConfig());
$get_output = $config['output'];
$return_spec = $config['returnSpec'] ?? shape(
'getter' => 'getPath',
'type' => 'string',
);
$builder = (new UriBuilderCodegenBuilder(
$this->getHackCodegenConfig(),
$base,
$param_builder,
$return_spec['getter'],
$return_spec['type'],
))
->setGeneratedFrom($this->getGeneratedFrom())
->setDiscardChanges(
Shapes::idx($this->config ?? shape(), 'discardChanges', false),
);
$controllers = $this->controllerFacts->getControllers()->keys();
foreach ($controllers as $controller) {
$output = $get_output($controller);
if ($output === null) {
continue;
}
$builder->renderToFile(
$output['file'],
shape(
'controller' => $controller,
'namespace' => Shapes::idx($output, 'namespace'),
'class' => $output['class'],
'trait' => $output['trait'] ?? null,
),
);
}
}