<?php

namespace RistrettoApps\Spawnster\Helpers;

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

class ComponentView implements ViewInterface
{
    use ConstantsTrait;

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