Skip to content

Instantly share code, notes, and snippets.

@nyanloutre
Last active October 3, 2018 08:47
Show Gist options
  • Save nyanloutre/5f640d5d7074f3db7e3815d5937eee58 to your computer and use it in GitHub Desktop.
Save nyanloutre/5f640d5d7074f3db7e3815d5937eee58 to your computer and use it in GitHub Desktop.
''
<?php
$config = array();
${concatStrings (
mapAttrsToList (name: value:
"$config['${name}'] = " +
(if isInt value then
"${toString value}"
else if isString value then
"'${value}'"
else if isBool value then
(a: if a then "true" else "false") value
else if isList value then
''
array(
${foldr (item: prev: "'${item}',\n${prev}") "" value}
)''
else
"null")
+ ";\n"
) cfg.config)}
''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment