Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/old/vendor/magento/framework/Data/Argument/Interpreter/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/magento/framework/Data/Argument/Interpreter/ArrayType.php
<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
namespace Magento\Framework\Data\Argument\Interpreter;

use InvalidArgumentException;
use Magento\Framework\Data\Argument\InterpreterInterface;
use Magento\Framework\ObjectManager\Helper\SortItems as SortItemsHelper;

/**
 * Interpreter of array data type that supports arrays of unlimited depth
 */
class ArrayType implements InterpreterInterface
{
    /**
     * Interpreter of individual array item
     *
     * @var InterpreterInterface
     */
    private InterpreterInterface $itemInterpreter;

    /**
     * @var SortItemsHelper
     */
    private SortItemsHelper $sortItemsHelper;

    /**
     * @param InterpreterInterface $itemInterpreter
     * @param SortItemsHelper|null $sortItemsHelper
     */
    public function __construct(InterpreterInterface $itemInterpreter, SortItemsHelper $sortItemsHelper = null)
    {
        $this->itemInterpreter = $itemInterpreter;
        $this->sortItemsHelper = $sortItemsHelper ?: new \Magento\Framework\ObjectManager\Helper\SortItems();
    }

    /**
     * @inheritdoc
     * @return array
     * @throws InvalidArgumentException
     */
    public function evaluate(array $data): array
    {
        $items = $data['item'] ?? [];
        if (!is_array($items)) {
            throw new InvalidArgumentException('Array items are expected.');
        }
        $result = [];
        $items = $this->sortItemsHelper->sortItems($items);
        foreach ($items as $itemKey => $itemData) {
            $result[$itemKey] = $this->itemInterpreter->evaluate($itemData);
        }
        return $result;
    }
}

Spamworldpro Mini