<?php

namespace Lc\SovBundle\Translation;


use Symfony\Component\HttpFoundation\Session\SessionInterface;

/**
 * class FlashBag.
 *
 * @author La clic !!!!
 */
class FlashBagTranslator
{

    protected SessionInterface $session;
    protected TranslatorAdmin $translatorAdmin;

    public function __construct(SessionInterface $session, TranslatorAdmin $translatorAdmin)
    {
        $this->session = $session;
        $this->translatorAdmin = $translatorAdmin;
    }

    /**
     * {@inheritdoc}
     */
    public function add(
            string $type,
            $translationKeyName,
            $translationEntityName = null,
            $translationParam = array()
    ): void {
        $this->session->getFlashBag()->add(
                $type,
                $this->translatorAdmin->transFlashMessage(
                        $type,
                        $translationKeyName,
                        $translationEntityName,
                        $translationParam
                )
        );
    }
}
