@@ -43,28 +43,19 @@ private function extractConfig(array $data)
43
43
public function sanitize (array $ data ): array
44
44
{
45
45
$ config = $ this ->extractConfig ($ data );
46
- $ toProcess = [];
47
- array_walk (
48
- $ data ,
49
- function ($ datum , string $ key ) use (&$ config , &$ toProcess ) : void {
50
- if (is_array ($ datum )) {
51
- //Each array must have it's own __disableTmpl property
52
- $ toProcess [$ key ] = $ datum ;
53
- } elseif ((
54
- !is_bool ($ config ) && !array_key_exists ($ key , $ config )
55
- )
56
- && (is_string ($ datum ) || $ datum instanceof Phrase)
57
- && preg_match ('/\$\{.+\}/ ' , (string )$ datum )
58
- ) {
59
- //Templating is not disabled for all properties or for this property specifically
60
- //Property is a string that contains template syntax so we are disabling it's rendering
61
- $ config [$ key ] = true ;
62
- }
46
+ foreach ($ data as $ key => $ datum ) {
47
+ if (is_array ($ datum )) {
48
+ //Each array must have its own __disableTmpl property
49
+ $ data [$ key ] = $ this ->sanitize ($ datum );
50
+ } elseif (!is_bool ($ config )
51
+ && !array_key_exists ($ key , $ config )
52
+ && (is_string ($ datum ) || $ datum instanceof Phrase)
53
+ && preg_match ('/\$\{.+\}/ ' , (string )$ datum )
54
+ ) {
55
+ //Templating is not disabled for all properties or for this property specifically
56
+ //Property is a string that contains template syntax, so we are disabling its rendering
57
+ $ config [$ key ] = true ;
63
58
}
64
- );
65
- if ($ toProcess ) {
66
- //Processing sub-arrays
67
- $ data = array_replace ($ data , array_map ([$ this , 'sanitize ' ], $ toProcess ));
68
59
}
69
60
if ($ config !== []) {
70
61
//Some properties require rendering configuration.
0 commit comments