<?php declare(strict_types=1);
namespace TigerMedia\CustomFieldHelper;
use Shopware\Core\Framework\Plugin;
use TigerMedia\CustomFieldHelper\Model\ConfigurableInterface;
class CustomFieldHelper extends Plugin
{
/**
* @param ConfigurableInterface[] $array
* @param bool $doMerge
* @return array
*/
public static function configurableArrayToConfig(array $array, bool $doMerge = false): array
{
$res = [];
foreach ($array as $item)
{
if($doMerge)
{
$res = array_merge($res, $item->toConfig());
}else{
$res[] = $item->toConfig();
}
}
return $res;
}
}