Bluz\View\View::__toString PHP Method

__toString() public method

Render like string
public __toString ( ) : string
return string
    public function __toString()
    {
        ob_start();
        try {
            if (!file_exists($this->path . '/' . $this->template) || !is_file($this->path . '/' . $this->template)) {
                throw new ViewException("Template '{$this->template}' not found");
            }
            extract($this->container);
            require $this->path . '/' . $this->template;
        } catch (\Exception $e) {
            // clean output
            ob_end_clean();
            // @codeCoverageIgnoreStart
            if (Application::getInstance()->isDebug()) {
                return $e->getMessage() . "\n<br/>" . $e->getTraceAsString();
            }
            // @codeCoverageIgnoreEnd
            // nothing for production
            return '';
        }
        return ob_get_clean();
    }