<?php

namespace RistrettoApps\Spawnster\Helpers;

use RistrettoApps\Spawnster\Interfaces\ConstantsTrait;
use RistrettoApps\Spawnster\Interfaces\ViewInterface;

class TemplateView implements ViewInterface
{
    use ConstantsTrait;

    /**
     * Renders the template view.
     *
     * @param $view
     * @param $data
     * @return string
     *
     * @since 1.0.0
     */
    public static function render($view, $data = []): string
    {
        extract($data);
        return include_once self::getPluginDir() . self::VIEW_PATH . $view . '.php';
    }
}