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/module-email/ViewModel/Template/Preview/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/magento/module-email/ViewModel/Template/Preview/Form.php
<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
declare(strict_types=1);

namespace Magento\Email\ViewModel\Template\Preview;

use Magento\Framework\App\RequestInterface;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\View\Element\Block\ArgumentInterface;

/**
 * Class Form
 */
class Form implements ArgumentInterface
{
    private $expectedParamsGetRequest = [
        'id'
    ];

    private $expectedParamsPostRequest = [
        'text',
        'type',
        'styles'
    ];

    /**
     * @var RequestInterface
     */
    private $request;

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

    /**
     * Gets the fields to be included in the email preview form.
     *
     * @return array
     * @throws LocalizedException
     */
    public function getFormFields()
    {
        $params = $fields = [];
        $method = $this->request->getMethod();

        if ($method === 'GET') {
            $params = $this->expectedParamsGetRequest;
        } elseif ($method === 'POST') {
            $params = $this->expectedParamsPostRequest;
        }

        foreach ($params as $paramName) {
            $fieldValue = $this->request->getParam($paramName);
            if ($fieldValue === null) {
                throw new LocalizedException(
                    __("Missing expected parameter \"$paramName\" while attempting to generate template preview.")
                );
            }
            $fields[$paramName] = $fieldValue;
        }

        return $fields;
    }
}

Spamworldpro Mini