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/View/Element/Message/Renderer/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/magento/framework/View/Element/Message/Renderer/BlockRenderer.php
<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
namespace Magento\Framework\View\Element\Message\Renderer;

use Magento\Framework\Message\MessageInterface;
use Magento\Framework\View\Element\Message\Renderer\BlockRenderer\Template;

class BlockRenderer implements RendererInterface
{
    /**
     * complex_renderer
     */
    const CODE = 'block_renderer';

    /**
     * @var array
     */
    private $configuration;

    /**
     * @var Template
     */
    private $template;

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

    /**
     * Renders complex message
     *
     * @param MessageInterface $message
     * @param array $initializationData
     * @return string
     */
    public function render(MessageInterface $message, array $initializationData)
    {
        $this->setUpConfiguration($message->getData(), $initializationData);

        $result = $this->template->toHtml();

        $this->tearDownConfiguration();

        return $result;
    }

    /**
     * @param array $configuration
     * @param array $initializationData
     * @return void
     */
    private function setUpConfiguration(array $configuration, array $initializationData)
    {
        if (!isset($initializationData['template'])) {
            throw new \InvalidArgumentException('Template should be provided for the renderer.');
        }

        $this->configuration = $configuration;

        $this->template->setTemplate($initializationData['template']);
        $this->template->setData($configuration);
    }

    /**
     * @return void
     */
    private function tearDownConfiguration()
    {
        foreach (array_keys($this->configuration) as $key) {
            $this->template->unsetData($key);
            unset($this->configuration[$key]);
        }

        $this->template->setTemplate('');
    }
}

Spamworldpro Mini