code: public function add(
          $template,
          array $data = [],
          string $region = "main",
          int $sort = 0
      ) : object {
          $view = new View();
  
          if (empty($template)) {
              $tpl = null;
              $type = "empty";
          } elseif (is_string($template)) {
              $tpl = $this->getTemplateFile($template);
              $type = "file";
          } elseif (is_array($template)) {
              // Can be array with complete view or array with callable callback
              $tpl = $template;
              $type = "empty";
              $region = $tpl["region"] ?? $region;
  
              if (isset($tpl["callback"])) {
                  $tpl["template"] = $template;
                  $tpl["type"] = "callback";
              } elseif (isset($tpl["template"])) {
                  if (!isset($tpl["type"]) || $tpl["type"] === "file") {
                      $tpl["type"] = "file";
                      $tpl["template"] = $this->getTemplateFile($tpl["template"]);
                  }
              }
          }
  
          $view->set($tpl, $data, $sort, $type);
          $this->views[$region][] = $view;
  
          return $this;
      }
docs: Add (create) a view to be included, pass optional data and put the
  view in an optional specific region (default region is "main") and
  pass an optional sort value where the highest value is rendered first.
  The $template can be a:
  filename (string),
  callback (array with key callback set to a callable array),
  view array (key value array with template, data, region, sort)
  
  @param array|string  $template the name of the template file to include.
  @param array         $data     variables to make available to the view,
  default is empty.
  @param string        $region   which region to attach the view, default
  is "main".
  @param integer       $sort     which order to display the views.
  
  @return self for chaining.