| @@ 136-142 (lines=7) @@ | ||
| 133 | ||
| 134 | $results = []; |
|
| 135 | ||
| 136 | foreach ($array as $key => $value) { |
|
| 137 | if (is_array($value)) { |
|
| 138 | $results = array_merge($results, $this->dot($value, $prepend . $key . '.')); |
|
| 139 | } else { |
|
| 140 | $results[$prepend . $key] = $value; |
|
| 141 | } |
|
| 142 | } |
|
| 143 | ||
| 144 | return $this->dotted[$cache] = $results; |
|
| 145 | } |
|
| @@ 160-166 (lines=7) @@ | ||
| 157 | { |
|
| 158 | $flattened = []; |
|
| 159 | ||
| 160 | foreach ($array as $key => $value) { |
|
| 161 | if (is_array($value)) { |
|
| 162 | $flattened = array_merge($flattened, $this->flatten($value, $separator, $prepend . $key . $separator)); |
|
| 163 | } else { |
|
| 164 | $flattened[$prepend . $key] = $value; |
|
| 165 | } |
|
| 166 | } |
|
| 167 | ||
| 168 | return $flattened; |
|
| 169 | } |
|