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/cartforge.co/vendor/magento/module-search/Model/SearchEngine/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/cartforge.co/vendor/magento/module-search/Model/SearchEngine/Validator.php
<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
declare(strict_types=1);

namespace Magento\Search\Model\SearchEngine;

use Magento\Framework\App\Config\ScopeConfigInterface;

/**
 * Validate search engine configuration
 */
class Validator implements ValidatorInterface
{
    /**
     * @var ScopeConfigInterface
     */
    private $scopeConfig;

    /**
     * @var array
     */
    private $excludedEngineList = ['mysql' => 'MySQL'];

    /**
     * @var ValidatorInterface[]
     */
    private $engineValidators;

    /**
     * @param ScopeConfigInterface $scopeConfig
     * @param array $engineValidators
     * @param array $excludedEngineList
     */
    public function __construct(
        ScopeConfigInterface $scopeConfig,
        array $engineValidators = [],
        array $excludedEngineList = []
    ) {
        $this->scopeConfig = $scopeConfig;
        $this->engineValidators = $engineValidators;
        $this->excludedEngineList = array_merge($this->excludedEngineList, $excludedEngineList);
    }

    /**
     * @inheritDoc
     */
    public function validate(): array
    {
        $errors = [];
        $currentEngine = $this->scopeConfig->getValue('catalog/search/engine');
        if (isset($this->excludedEngineList[$currentEngine])) {
            $excludedEngine = $this->excludedEngineList[$currentEngine];
            $errors[] = "Your current search engine, '{$excludedEngine}', is not supported."
                . " You must install a supported search engine before upgrading."
                . " See the System Upgrade Guide for more information.";
        }

        if (isset($this->engineValidators[$currentEngine])) {
            $validator = $this->engineValidators[$currentEngine];
            $validationErrors = $validator->validate();
            $errors = array_merge($errors, $validationErrors);
        }
        return $errors;
    }
}

Spamworldpro Mini