Your IP : 216.73.217.13


Current Path : /home/rtorresani/www/vendor/magento/module-store-graph-ql/Model/Context/
Upload File :
Current File : //home/rtorresani/www/vendor/magento/module-store-graph-ql/Model/Context/AddStoreInfoToContext.php

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

namespace Magento\StoreGraphQl\Model\Context;

use Magento\GraphQl\Model\Query\ContextParametersInterface;
use Magento\GraphQl\Model\Query\ContextParametersProcessorInterface;
use Magento\Store\Model\StoreManagerInterface;

/**
 * @inheritdoc
 */
class AddStoreInfoToContext implements ContextParametersProcessorInterface
{
    /**
     * @var StoreManagerInterface
     */
    private $storeManager;

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

    /**
     * @inheritdoc
     */
    public function execute(ContextParametersInterface $contextParameters): ContextParametersInterface
    {
        $currentStore = $this->storeManager->getStore();
        $contextParameters->addExtensionAttribute('store', $currentStore);

        return $contextParameters;
    }
}