33 public function create( array $data,
$header =
'Automatically generated' ) {
34 return self::write( $data,
$header );
45 .
"// " . implode(
"\n// ", explode(
"\n",
$header ) ) .
"\n"
47 foreach ( $data as $key => $value ) {
48 $code .= self::encode( $key, $value, 1 );
62 private static function encode( $key, $value, $indent ) {
63 $tabs = str_repeat(
"\t", $indent );
64 $line = $tabs . var_export( $key,
true ) .
' => ';
65 if ( is_array( $value ) ) {
67 foreach ( $value as $subkey => $subvalue ) {
68 $line .= self::encode( $subkey, $subvalue, $indent + 1 );
72 $line .= var_export( $value,
true );