| @@ 158-164 (lines=7) @@ | ||
| 155 | ||
| 156 | $results = []; |
|
| 157 | ||
| 158 | foreach ($array as $key => $value) { |
|
| 159 | if (is_array($value)) { |
|
| 160 | $results = array_merge($results, $this->dot($value, $prepend . $key . '.')); |
|
| 161 | } else { |
|
| 162 | $results[$prepend . $key] = $value; |
|
| 163 | } |
|
| 164 | } |
|
| 165 | ||
| 166 | return $this->dotted[$cache] = $results; |
|
| 167 | } |
|
| @@ 182-188 (lines=7) @@ | ||
| 179 | { |
|
| 180 | $flattened = []; |
|
| 181 | ||
| 182 | foreach ($array as $key => $value) { |
|
| 183 | if (is_array($value)) { |
|
| 184 | $flattened = array_merge($flattened, $this->flatten($value, $separator, $prepend . $key . $separator)); |
|
| 185 | } else { |
|
| 186 | $flattened[$prepend . $key] = $value; |
|
| 187 | } |
|
| 188 | } |
|
| 189 | ||
| 190 | return $flattened; |
|
| 191 | } |
|