<?php
namespace Qii\View;

class Loader
{
	protected $view;
	protected $allow = array('smarty', 'requires', 'includes');
	
	public function __construct(){

	}

    /**
     * 设置 view 支持自定义
     * @param string $engine 模版引擎
     * @param array $policy 初始化传递的参数
     * @return mixed|\Qii\Autoloader\Psr4|null
     */
	public function setView($engine, $policy = array()) {
        $class = '\Qii\View\\'. ucwords($engine);
		if(!in_array($engine, $this->allow))
		{
            $class = ucwords($engine);
		}
		return $this->view = _loader($class, $policy);
	}

    /**
     * 获取view
     *
     * @return mixed
     */
	public function getView() {
		return $this->view;
	}
}