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/Indexer/Config/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/magento/framework/Indexer/Config/DependencyInfoProvider.php
<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
declare(strict_types=1);

namespace Magento\Framework\Indexer\Config;

use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Framework\Indexer\ConfigInterface;
use Magento\Framework\Phrase;

/**
 * @inheritdoc
 */
class DependencyInfoProvider implements DependencyInfoProviderInterface
{
    /**
     * @var ConfigInterface
     */
    private $config;

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

    /**
     * @inheritdoc
     */
    public function getIndexerIdsToRunBefore(string $indexerId): array
    {
        return $this->getIndexerDataWithValidation($indexerId)['dependencies'];
    }

    /**
     * @inheritdoc
     */
    public function getIndexerIdsToRunAfter(string $indexerId): array
    {
        /** check indexer existence */
        $this->getIndexerDataWithValidation($indexerId);
        $result = [];
        foreach ($this->config->getIndexers() as $id => $indexerData) {
            if (array_search($indexerId, $indexerData['dependencies']) !== false) {
                $result[] = $id;
            }
        }

        return $result;
    }

    /**
     * Return the indexer data from the configuration.
     *
     * @param string $indexerId
     * @return array
     */
    private function getIndexerData(string $indexerId): array
    {
        return $this->config->getIndexer($indexerId);
    }

    /**
     * Return the indexer data from the configuration and validate this data.
     *
     * @param string $indexerId
     * @return array
     * @throws NoSuchEntityException In case when the indexer with the specified Id does not exist.
     */
    private function getIndexerDataWithValidation(string $indexerId): array
    {
        $indexerData = $this->getIndexerData($indexerId);
        if (!isset($indexerData['indexer_id']) || $indexerData['indexer_id'] != $indexerId) {
            throw new NoSuchEntityException(
                new Phrase("%1 indexer does not exist.", [$indexerId])
            );
        }

        return $indexerData;
    }
}

Spamworldpro Mini