This repository was archived by the owner on Jan 30, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +10
-11
lines changed Expand file tree Collapse file tree 1 file changed +10
-11
lines changed Original file line number Diff line number Diff line change @@ -97,27 +97,26 @@ public function getFieldValue()
97
97
{
98
98
$ nvPairs = [];
99
99
100
- $ cookies = [];
101
- $ this ->flattenCookies ($ cookies , $ this );
102
-
103
- foreach ($ cookies as $ name => $ value ) {
100
+ foreach ($ this ->flattenCookies ($ this ) as $ name => $ value ) {
104
101
$ nvPairs [] = $ name . '= ' . (($ this ->encodeValue ) ? urlencode ($ value ) : $ value );
105
102
}
106
103
107
104
return implode ('; ' , $ nvPairs );
108
105
}
109
106
110
- protected function flattenCookies (& $ result , $ data , $ prefix = null )
107
+ protected function flattenCookies ($ data , $ prefix = null )
111
108
{
112
- if (!is_array ($ data ) && $ this !== $ data ) {
113
- $ result [$ prefix ] = $ data ;
114
- return ;
115
- }
116
-
109
+ $ result = [];
117
110
foreach ($ data as $ key => $ value ) {
118
111
$ key = $ prefix ? $ prefix . '[ ' . $ key . '] ' : $ key ;
119
- $ this ->flattenCookies ($ result , $ value , $ key );
112
+ if (is_array ($ value )) {
113
+ $ result = array_merge ($ result , $ this ->flattenCookies ($ value , $ key ));
114
+ } else {
115
+ $ result [$ key ] = $ value ;
116
+ }
120
117
}
118
+
119
+ return $ result ;
121
120
}
122
121
123
122
public function toString ()
You can’t perform that action at this time.
0 commit comments