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/mirasvit/module-core/src/Core/Block/Adminhtml/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/mirasvit/module-core/src/Core/Block/Adminhtml/Validator.php
<?php
/**
 * Mirasvit
 *
 * This source file is subject to the Mirasvit Software License, which is available at https://mirasvit.com/license/.
 * Do not edit or add to this file if you wish to upgrade the to newer versions in the future.
 * If you wish to customize this module for your needs.
 * Please refer to http://www.magentocommerce.com for more information.
 *
 * @category  Mirasvit
 * @package   mirasvit/module-core
 * @version   1.4.31
 * @copyright Copyright (C) 2023 Mirasvit (https://mirasvit.com/)
 */



namespace Mirasvit\Core\Block\Adminhtml;

use Magento\Backend\Block\Template;
use Magento\Backend\Block\Template\Context;
use Mirasvit\Core\Api\Service\ValidationServiceInterface;
use Mirasvit\Core\Api\Service\ValidatorInterface;

class Validator extends Template
{
    /**
     * @var string
     */
    protected $_template = 'Mirasvit_Core::validator.phtml';

    /**
     * @var ValidationServiceInterface
     */
    private $validationService;

    /**
     * @var array
     */
    private $results = [];

    /**
     * Validator constructor.
     * @param ValidationServiceInterface $validationService
     * @param Context $context
     * @param array $data
     */
    public function __construct(
        ValidationServiceInterface $validationService,
        Context $context,
        array $data = []
    ) {
        $this->validationService = $validationService;

        parent::__construct($context, $data);
    }

    /**
     * Get validation result.
     *
     * @return array[]
     */
    public function getResult()
    {
        if (!$this->results) {
            $modules = [];

            $module = $this->getRequest()->getParam('module');
            if ($module) {
                $modules[] = $module;
            }

            $this->results = $this->validationService->runValidation($modules);
        }

        return $this->results;
    }

    /**
     * Whether a validation is passed or some tests fail.
     *
     * @return bool
     */
    public function isPassed()
    {
        foreach ($this->getResult() as $result) {
            if ($result[ValidatorInterface::STATUS_CODE] == ValidatorInterface::FAILED) {
                return false;
            }
        }

        return true;
    }

    /**
     * Get label for status.
     *
     * @param int $status
     *
     * @return string
     */
    public function getStatusLabel($status)
    {
        $statusLabels = [
            ValidatorInterface::FAILED  => 'error',
            ValidatorInterface::WARNING => 'warning',
            ValidatorInterface::INFO    => 'info',
            ValidatorInterface::SUCCESS => 'success',
        ];

        return $statusLabels[$status];
    }
}

Spamworldpro Mini