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/framework/Phrase/Renderer/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/cartforge.co/vendor/magento/framework/Phrase/Renderer/MessageFormatter.php
<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

declare(strict_types=1);

namespace Magento\Framework\Phrase\Renderer;

use Magento\Framework\Phrase\RendererInterface;
use Magento\Framework\TranslateInterface;

/**
 * Process texts to resolve ICU MessageFormat
 */
class MessageFormatter implements RendererInterface
{
    /** @var TranslateInterface */
    private $translate;

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

    /**
     * @inheritdoc
     */
    public function render(array $source, array $arguments)
    {
        $text = end($source);

        if (strpos($text, '{') === false) {
            // About 5x faster for non-MessageFormatted strings
            // Only slightly slower for MessageFormatted strings (~0.3x)
            return $text;
        }

        $result = \MessageFormatter::formatMessage($this->translate->getLocale(), $text, $arguments);
        return $result !== false ? $result : $text;
    }
}

Spamworldpro Mini