<?php

namespace Ministra\Lib;

use Ministra\Lib\w13ec15f0067ea75861e61e27c990e4ba\d3507c2999d38573a0a0c91771d70af2;
class Advertising
{
    public function __construct()
    {
    }
    public function getMainMini()
    {
        $ad = $this->getMain();
        if (\array_key_exists('text', $ad)) {
            unset($ad['text']);
        }
        return $ad;
    }
    public function getMain()
    {
        $ad = \Ministra\Lib\w13ec15f0067ea75861e61e27c990e4ba\d3507c2999d38573a0a0c91771d70af2::getInstance()->from('main_page_ad')->get()->all();
        if (\count($ad) > 0) {
            return $ad[0];
        }
    }
    public function setMain($title = '', $text = '', $video_id = 0)
    {
        $rows = \Ministra\Lib\w13ec15f0067ea75861e61e27c990e4ba\d3507c2999d38573a0a0c91771d70af2::getInstance()->count()->from('main_page_ad')->get()->counter();
        if ($rows > 0) {
            \Ministra\Lib\w13ec15f0067ea75861e61e27c990e4ba\d3507c2999d38573a0a0c91771d70af2::getInstance()->update('main_page_ad', ['title' => $title, 'text' => $text, 'video_id' => (int) $video_id], []);
        } else {
            \Ministra\Lib\w13ec15f0067ea75861e61e27c990e4ba\d3507c2999d38573a0a0c91771d70af2::getInstance()->insert('main_page_ad', ['title' => $title, 'text' => $text, 'video_id' => (int) $video_id]);
        }
    }
    public function delMain()
    {
        \Ministra\Lib\w13ec15f0067ea75861e61e27c990e4ba\d3507c2999d38573a0a0c91771d70af2::getInstance()->query('delete from main_page_ad');
    }
}
