<?php

namespace ThurData\Servers\KerioEmail\Core\SL;

use ThurData\Servers\KerioEmail\Core\FileReader\Reader;

/**
 * Description of AbstractReaderYml
 *
 * @autor ThurData <info@thurdata.ch>
 */
abstract class AbstractReaderYml
{
    /**
     * @var array
     */
    protected $data = [];

    public function __construct()
    {
        if (count($this->data) == 0)
        {
            $this->load();
        }
    }

    public function getData()
    {
        return $this->data;
    }

    protected function readYml($name)
    {
        return Reader::read($name)->get();
    }

    public static function get()
    {

        $instance = new static;
        return $instance->getData();
    }

    abstract protected function load();
}
