in build/JsonCompiler.php [38:70]
private function getTranspiledPhp()
{
// Use var_export as a starting point.
$code = var_export($this->getDecodedData(), true);
// Convert "array()" to "[]".
$code = str_replace('array (', '[', $code);
$code = str_replace(')', ']', $code);
// Removing trailing whitespace.
$code = preg_replace('/\s+$/m', '', $code);
// Move arrays to the same line.
$code = preg_replace('/=>\s*\n\s*\[/', '=> [', $code);
// Get rid of numbered array indexes.
$code = preg_replace('/(\s*)(\d+ => )/', '$1', $code);
// Make empty arrays span only a single line.
$code = preg_replace('/=>\s*\[\n\s*\]/', '=> []', $code);
// Minify the PHP file
$code = preg_replace('/\s+/', ' ', str_replace("\n", '', $code));
$originalPath = preg_replace('/^.+?(?=\/src\/data\/)/', '', $this->path);
return <<<EOPHP
<?php
// This file was auto-generated from sdk-root$originalPath
return $code;
EOPHP;
}