<?php

namespace ModulesGarden\HostingQuotaNotifications\App\Cron\WithoutThread;

use ModulesGarden\HostingQuotaNotifications\Core\CommandLine\AbstractCronControllerWithoutThread;
use \ModulesGarden\HostingQuotaNotifications\App\Libs\Cron\Prepare;
use \ModulesGarden\HostingQuotaNotifications\App\Libs\Cron\Notifications;
use ModulesGarden\HostingQuotaNotifications\App\Helper\Logger\Log;

/**
 * Description of Notification
 *
 * @author Artur Pilch <artur.pi@modulesgarden.com>
 */
class Notification extends AbstractCronControllerWithoutThread
{
    public function run()
    {
        try
        {
            Log::cronLog('start');

            $cronPrepare = new Prepare();
            $cronPrepare->clearDatabase();

            $notifications = new Notifications();
            $notifications->run();

            Log::cronLog('finish');
        }
        catch (\Exception $exc)
        {
            \logModuleCall('hosting_quota_notification', 'cron error', [], var_export($exc, true));
        }
    }
}