/**
  * Method to instantiate the view.
  *
  * @param   App             $app             The application object.
  * @param   ModelInterface  $model           The model object.
  * @param   string|array    $templatesPaths  The templates paths.
  *
  * @throws  \RuntimeException
  * @since   1.0
  */
 public function __construct(App $app, ModelInterface $model, $templatesPaths = '')
 {
     parent::__construct($model);
     $this->app = $app;
     $renderer = $app->getContainer()->get('config')->get('renderer.type');
     $className = 'App\\View\\Renderer\\' . ucfirst($renderer);
     if (false == class_exists($className)) {
         throw new \RuntimeException(sprintf('Invalid renderer: %s', $renderer));
     }
     $config = array();
     $config['templates_base_dir'] = JPATH_TEMPLATES;
     // Load the renderer.
     $this->renderer = new $className($config);
     // Register application's Twig extension.
     $this->renderer->addExtension(new TwigExtension($app));
     // Register additional paths.
     if (!empty($templatesPaths)) {
         $this->renderer->setTemplatesPaths($templatesPaths, true);
     }
     // Register the theme path
     $this->renderer->set('themePath', DEFAULT_THEME . '/');
     // Retrieve and clear the message queue
     $this->renderer->set('flashBag', $app->getMessageQueue());
     $app->clearMessageQueue();
 }