Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php /** * Copyright Magento, Inc. All rights reserved. * See COPYING.txt for license ..

Decoded Output download

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

namespace Magento\CatalogGraphQl\Model\Resolver\Products\DataProvider;

/**
 * Flatten custom attributes
 */
class CustomAttributesFlattener
{
    /**
     * Flatten custom attributes within its enclosing array to normalize key-value pairs.
     *
     * @param array $categoryData
     * @return array
     */
    public function flatten(array $categoryData) : array
    {
        if (!isset($categoryData['custom_attributes'])) {
            return $categoryData;
        }

        foreach ($categoryData['custom_attributes'] as $attributeData) {
            $categoryData[$attributeData['attribute_code']] = $attributeData['value'];
        }

        unset($categoryData['custom_attributes']);

        return $categoryData;
    }
}
 ?>

Did this file decode correctly?

Original Code

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

namespace Magento\CatalogGraphQl\Model\Resolver\Products\DataProvider;

/**
 * Flatten custom attributes
 */
class CustomAttributesFlattener
{
    /**
     * Flatten custom attributes within its enclosing array to normalize key-value pairs.
     *
     * @param array $categoryData
     * @return array
     */
    public function flatten(array $categoryData) : array
    {
        if (!isset($categoryData['custom_attributes'])) {
            return $categoryData;
        }

        foreach ($categoryData['custom_attributes'] as $attributeData) {
            $categoryData[$attributeData['attribute_code']] = $attributeData['value'];
        }

        unset($categoryData['custom_attributes']);

        return $categoryData;
    }
}

Function Calls

None

Variables

None

Stats

MD5 e6c1d40746e3f7cb9a65291473bff312
Eval Count 0
Decode Time 104 ms