/**
  * 
  * Executes a PHP file and returns its output as a string. This file is 
  * supposed to contain the output markup (usually html) for the current 
  * controller action method being executed.
  * 
  * @param string $file_name name of the file (including extension eg. `read.php`) 
  *                          containing valid php to be executed and returned as
  *                          string.
  * @param array $data an array of data to be passed to the view file. Each
  *                    key in this array is automatically converted to php
  *                    variables accessible in the view file. 
  *                    Eg. passing ['content'=>'yabadabadoo'] to this method 
  *                    will result in a variable named $content (with a 
  *                    value of 'yabadabadoo') being available in the view
  *                    file (i.e. the file named $file_name).
  * @return string
  * 
  * @throws \Slim3MvcTools\Controllers\Exceptions\IncorrectlySetPropertyException
  * 
  */
 public function renderView($file_name, array $data = [])
 {
     if (!$this->view_renderer instanceof \Rotexsoft\FileRenderer\Renderer) {
         try {
             $this->view_renderer = $this->getContainerItem('new_view_renderer');
         } catch (ExpectedContainerItemMissingException $ex) {
             $msg = "ERROR: The `view_renderer` property of `" . get_class($this) . "`" . " must be set via a call to `" . get_class($this) . '::setViewRenderer(...)` ' . " before calling `" . get_class($this) . '::' . __FUNCTION__ . '(...)`.' . PHP_EOL;
             throw new IncorrectlySetPropertyException($msg);
         }
     }
     $parent_classes = [];
     $parent_class = get_parent_class($this);
     while ($parent_class !== __CLASS__ && !empty($parent_class)) {
         $parent_classes[] = (new \ReflectionClass($parent_class))->getShortName();
         $parent_class = get_parent_class($parent_class);
     }
     //Try to prepend view folder for this controller.
     //It takes precedence over the view folder
     //for the base controller.
     $ds = DIRECTORY_SEPARATOR;
     $path_2_view_files = S3MVC_APP_ROOT_PATH . $ds . 'src' . $ds . 'views' . $ds;
     while ($parent_class = array_pop($parent_classes)) {
         $parent_class_folder = \Slim3MvcTools\Functions\Str\toDashes($parent_class);
         if (!$this->view_renderer->hasPath($path_2_view_files . $parent_class_folder) && file_exists($path_2_view_files . $parent_class_folder)) {
             $this->view_renderer->prependPath($path_2_view_files . $parent_class_folder);
         }
     }
     //finally add my view folder
     if (!$this->view_renderer->hasPath($path_2_view_files . $this->controller_name_from_uri) && file_exists($path_2_view_files . $this->controller_name_from_uri)) {
         $this->view_renderer->prependPath($path_2_view_files . $this->controller_name_from_uri);
     }
     return $this->view_renderer->renderToString($file_name, $data);
 }
 public function getVarTypePublic($var, $cap_1st = false)
 {
     return parent::getVarType($var, $cap_1st);
 }