Loader.php 483 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace Qii\View;
  3. class Loader
  4. {
  5. protected $view;
  6. protected $allow = array('smarty', 'require', 'include');
  7. public function __construct()
  8. {
  9. }
  10. public function setView($engine, $policy = array())
  11. {
  12. if(!in_array($engine, $this->allow))
  13. {
  14. throw new \Qii\Exceptions\Unsupport(\Qii::i('Unsupport method', $engine));
  15. }
  16. $class = '\Qii\View\\'. ucwords($engine);
  17. return $this->view = new $class();
  18. }
  19. public function getView()
  20. {
  21. return $this->view;
  22. }
  23. }