<?php

namespace ThurData\Servers\KerioEmail\Core\App\Requirements;

/**
 * Description of Handler
 *
 * @autor ThurData <info@thurdata.ch>
 */
abstract class Handler
{
    use \ThurData\Servers\KerioEmail\Core\Traits\Lang;

    protected $unfulfilledRequirements = [];

    protected function addUnfulfilledRequirement($message = null, $params = [])
    {
        if ($message)
        {
            $this->loadLang();
            $translated = $this->lang->absoluteTranslate('unfulfilledRequirement', $message);
            foreach ($params as $searchKey => $searchValue)
            {
                $translated = str_replace(':' . (string)$searchKey . ':', (string)$searchValue, $translated);
            }

            $this->unfulfilledRequirements[] = $translated;
        }
    }

    public function getUnfulfilledRequirements()
    {
        return $this->unfulfilledRequirements;
    }
}
