/
githubmirror
/
magento2
Обзор
Документация
Войти
/
githubmirror
/
magento2
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
2.4-develop
lib/internal/Magento/Framework/GraphQl/Query/Resolver/BatchResponse.php
67 строк
1 KB
Alexandra Zota
ACP2E-4019: CE copyright updates for 2.4.9-beta1
22 окт 2025, 17:47
22 окт 2025, 17:47
1b769b7
Код
Авторство
О чём код?
<?php /** * Copyright 2019 Adobe * All Rights Reserved. */ declare(strict_types=1); namespace Magento\Framework\GraphQl\Query\Resolver; use Magento\Framework\ObjectManager\ResetAfterRequestInterface; /** * Contains responses for batch requests. * * @api */ class BatchResponse implements ResetAfterRequestInterface { /** * @var \SplObjectStorage */ private $responses; /** * BatchResponse constructor. */ public function __construct() { $this->responses = new \SplObjectStorage(); } /** * Match response with request. * * @param BatchRequestItemInterface $request * @param array|int|string|float|Value $response * @return void */ public function addResponse(BatchRequestItemInterface $request, $response): void { $this->responses[$request] = $response; } /** * Get response assigned to the request. * * @param BatchRequestItemInterface $item * @return mixed|Value * @throws \InvalidArgumentException */ public function findResponseFor(BatchRequestItemInterface $item) { if (!$this->responses->offsetExists($item)) { throw new \InvalidArgumentException('Response does not exist'); } return $this->responses[$item]; } /** * @inheritDoc */ public function _resetState(): void { $this->responses = new \SplObjectStorage(); } }