<?php

namespace KupShop\DevelopmentBundle\View;

use KupShop\DevelopmentBundle\MailArchive;
use KupShop\KupShopBundle\Views\View;

class MailView extends View
{
    protected string $smartyFallback = 'blank';
    /**
     * @param string $template
     */
    protected $template = 'mail/mail.tpl';
    /**
     * @var MailArchive
     */
    private $mailArchive;

    public function __construct(MailArchive $mailArchive)
    {
        $this->mailArchive = $mailArchive;
    }

    public function getBodyVariables()
    {
        $body['emails'] = $this->mailArchive->getArchive();

        $testValue = 'test';
        setCache('testmailarchive', $testValue);
        if (getCache('testmailarchive') != $testValue) {
            $this->addErrorMessage('Nefunguje cache! Emaily se neukladaji :-(');
        }

        return $body;
    }
}
