Newer
Older
<?php
namespace IQDEV\ElasticSearchTests\Helpers;
class Arr
{
public static function convertingOneDimensional(array $expected, $startKey = null): array
{
$keys = [];
foreach ($expected as $key => $item) {
if ($startKey !== null) {
$key = $startKey.'.'.$key;
}
if (is_array($item)) {
$keys = array_merge($keys, static::convertingOneDimensional($item, $key));
continue;
}
$keys[$key] = $item;
}
return $keys;
}
}