public function render(ContainerInterface $di = null)
    {
        switch ($this->type) {
            case "file":
                if ($di->has("viewRenderFile")) {
                    $viewRender = $di->get("viewRenderFile");
                } else {
                    $viewRender = new ViewRenderFile($di);
                    $viewRender->setDI($di);
                }
                $viewRender->render($this->template, $this->templateData);
                break;

            case "callback":
                if (!is_callable($this->template)) {
                    throw new Exception("View is expecting a valid callback, provided callback seems to not be a callable.");
                }
                echo call_user_func($this->template, $this->templateData);
                break;

            case "string":
                echo $this->template;
                break;

            case "empty":
                break;

            default:
                throw new Exception("Not a valid template type: '{$this->type}'.");
        }
    }
public function render(ContainerInterface $di = null)
    {
        switch ($this->type) {
            case "file":
                if ($di->has("viewRenderFile")) {
                    $viewRender = $di->get("viewRenderFile");
                } else {
                    $viewRender = new ViewRenderFile($di);
                    $viewRender->setDI($di);
                }
                $viewRender->render($this->template, $this->templateData);
                break;

            case "callback":
                if (!is_callable($this->template)) {
                    throw new Exception("View is expecting a valid callback, provided callback seems to not be a callable.");
                }
                echo call_user_func($this->template, $this->templateData);
                break;

            case "string":
                echo $this->template;
                break;

            case "empty":
                break;

            default:
                throw new Exception("Not a valid template type: '{$this->type}'.");
        }
    }
public function render ( ContainerInterface $ di = null ) { switch ( $ this -> type ) { case "file" : if ( $ di -> has ( "viewRenderFile" ) ) { $ viewRender = $ di -> get ( "viewRenderFile" ) ; } else { $ viewRender = new ViewRenderFile ( $ di ) ; $ viewRender -> setDI ( $ di ) ; } $ viewRender -> render ( $ this -> template , $ this -> templateData ) ; break ; case "callback" : if ( ! is_callable ( $ this -> template ) ) { throw new Exception ( "View is expecting a valid callback, provided callback seems to not be a callable." ) ; } echo call_user_func ( $ this -> template , $ this -> templateData ) ; break ; case "string" : echo $ this -> template ; break ; case "empty" : break ; default : throw new Exception ( "Not a valid template type: '{$this->type}'." ) ; } }
Render the view by its type.

@param object $di optional with access to the framework resources.

@return void
Render the view by its type .