<?php

namespace ThurData\Servers\KerioEmail\Core\Traits;

use ThurData\Servers\KerioEmail\Core\App\Controllers\Instances\Addon\Config;
use ThurData\Servers\KerioEmail\Core\ServiceLocator;

/**
 * Description of IsDebugOn
 *
 * @autor ThurData <info@thurdata.ch>
 */
trait IsDebugOn
{
    protected $isDebug = null;    
    
    public function isDebugOn()
    {   
        if ($this->isDebug === null)
        {
            $addon = ServiceLocator::call(Config::class);
        
            $this->isDebug =  (bool)((int)$addon->getConfigValue('debug', "0"));
        }
        
        return $this->isDebug;
    }
}
