File tree 1 file changed +6
-17
lines changed
1 file changed +6
-17
lines changed Original file line number Diff line number Diff line change @@ -115,29 +115,18 @@ public function toArray()
115
115
*
116
116
* @return array
117
117
*/
118
- public function toFlat ( $ array = [], $ prefix = '' )
118
+ public function toFlat ( $ prefix = '. ' )
119
119
{
120
- function flatten ( $ array = [], $ prefix = '' , $ default = [] )
121
- {
122
-
123
- $ array = ( count ( $ array ) ) ? $ array : $ default ;
124
- $ result = [];
120
+ $ results = [];
121
+ foreach ( $ this ->strings as $ lang => $ strings ) {
125
122
126
- foreach ( $ array as $ key => $ value ) {
127
- $ new_key = $ prefix . ( empty ( $ prefix ) ? '' : '. ' ) . $ key ;
123
+ foreach ( $ strings as $ lang_array => $ lang_messages ) {
128
124
129
- if ( is_array ( $ value ) ) {
130
- $ result = array_merge ( $ result , flatten ( $ value , $ new_key ) );
131
- } else {
132
- $ result [ $ new_key ] = $ value ;
133
- }
125
+ $ key = $ lang . $ prefix . $ lang_array ;
126
+ $ results [ $ key ] = $ lang_messages ;
134
127
}
135
-
136
- return $ result ;
137
128
}
138
129
139
- $ results = flatten ( $ array , $ prefix , $ this ->strings );
140
-
141
130
return $ results ;
142
131
}
143
132
You can’t perform that action at this time.
0 commit comments