Your IP : 216.73.216.43


Current Path : /home/rtorresani/www/vendor/magento/module-catalog/Test/Fixture/
Upload File :
Current File : //home/rtorresani/www/vendor/magento/module-catalog/Test/Fixture/MultiselectAttribute.php

<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
declare(strict_types=1);

namespace Magento\Catalog\Test\Fixture;

use Magento\Framework\DataObject;

class MultiselectAttribute extends SelectAttribute
{
    private const DEFAULT_DATA = [
        'frontend_input' => 'multiselect',
    ];

    /**
     * @inheritdoc
     */
    public function apply(array $data = []): ?DataObject
    {
        $data = $this->prepareData($data);

        return parent::apply($data);
    }

    /**
     * Prepare attribute data
     *
     * @param array $data
     * @return array
     */
    private function prepareData(array $data): array
    {
        $data = array_merge(self::DEFAULT_DATA, $data);

        return $data;
    }
}