public function renderView($viewPath = null, $data = [], $layout = null)
    {
        ob_start();
        require($viewPath);
        $viewData = ob_get_contents();
        ob_end_clean();
        foreach($data as $key => $val) {
            if(is_array($val)) {
                if($key == 'meta') {
                    $this->data['meta'] = $val;
                }
            }
            else {
                $viewData = str_replace('{{'.$key.'}}', $val, $viewData);
            }
        }
        return $viewData;
    }
public function renderView($viewPath = null, $data = [], $layout = null)
    {
        ob_start();
        require($viewPath);
        $viewData = ob_get_contents();
        ob_end_clean();
        foreach($data as $key => $val) {
            if(is_array($val)) {
                if($key == 'meta') {
                    $this->data['meta'] = $val;
                }
            }
            else {
                $viewData = str_replace('{{'.$key.'}}', $val, $viewData);
            }
        }
        return $viewData;
    }
public function renderView ( $ viewPath = null , $ data = [ ] , $ layout = null ) { ob_start ( ) ; require ( $ viewPath ) ; $ viewData = ob_get_contents ( ) ; ob_end_clean ( ) ; foreach ( $ data as $ key => $ val ) { if ( is_array ( $ val ) ) { if ( $ key == 'meta' ) { $ this -> data [ 'meta' ] = $ val ; } } else { $ viewData = str_replace ( '{{' . $ key . '}}' , $ val , $ viewData ) ; } } return $ viewData ; }
Renders View for given data, template file and layout.

@param  string|null  $viewPath
@param  string       $data
@param  string|null  $layout
@return string
Renders View for given data template file and layout .