rich-id/excel-generator-bundle

View on GitHub
src/Helper/ArrayHelper.php

Summary

Maintainability
A
0 mins
Test Coverage
<?php

declare(strict_types=1);

namespace RichId\ExcelGeneratorBundle\Helper;

/**
 * Class ArrayHelper.
 *
 * @author     Nicolas Guilloux <nicolas.guilloux@rich-id.fr>
 * @copyright  2014 - 2021 Rich ID (https://www.rich-id.fr)
 */
final class ArrayHelper
{
    public static function mergeOptions(array $base, array $data): array
    {
        foreach ($data as $key => $value) {
            if (\is_array($value)) {
                $base[$key] = self::mergeOptions($base[$key] ?? [], $value);
            } else {
                $base[$key] = $value;
            }
        }

        return $base;
    }
}