<?php

namespace ModulesGarden\HostingQuotaNotifications\App\Libs\Migration;

use ModulesGarden\HostingQuotaNotifications\App\Helper\Migration\DBManager;
/**
 * Class MigratorBase
 *
 * @author Artur Pilch <artur.pi@modulesgarden.com>
 */
abstract class MigratorBase
{
    protected $table;
    protected $data;

    public function __construct($tableName)
    {
        $this->table = $tableName;
        $this->setData();
    }

    public function setData()
    {
        if(!DBManager::tableExist($this->table))
        {
            $this->data = [];
            return;
        }
        $this->data = DBManager::fetchData($this->table);
    }
}