diff --git a/src/Console/Commands/DumpCommand.php b/src/Console/Commands/DumpCommand.php index e17215d..4afe900 100644 --- a/src/Console/Commands/DumpCommand.php +++ b/src/Console/Commands/DumpCommand.php @@ -102,6 +102,17 @@ protected function write($dump) } } + private function assignArrayByPath(&$arr, $path, $value) { + $keys = explode('.', $path); + + while ($key = array_shift($keys)) { + $arr = &$arr[$key]; + if(is_array($arr)) ksort($arr); + } + + $arr = $value; + } + /** * @param $content * @param $locale @@ -110,6 +121,8 @@ protected function write($dump) */ protected function getFileTemplate($content, $locale, $group, $date) { + $content = $this->convertToOrderedNestedArray($content); + $array_text = var_export($content, true); $data = << $value) { + $this->assignArrayByPath($new_content, $key, $value); + } + $content = $new_content; + return $content; + } + }