public function addData(array $data, string $type = "all"): self
    {
        $this->viewData[$type] = array_merge($this->viewData[$type] ?? [], $data);
        return $this;
    }
public function addData(array $data, string $type = "all"): self
    {
        $this->viewData[$type] = array_merge($this->viewData[$type] ?? [], $data);
        return $this;
    }
public function addData ( array $ data , string $ type = "all" ) : self { $ this -> viewData [ $ type ] = array_merge ( $ this -> viewData [ $ type ] ?? [ ] , $ data ) ; return $ this ; }
Add view data

Adds an array of data to the internal view data container. The second parameter,
$type, defines if the data received will be used for a specific View, or
all views. The $type needs to be set to the full class name of a view in
order to be recognized as view data for that specific view. If the second
parameters is omitted or value "all" is used, then data will be used for
all views.

@param array $data View data
@param string $type View data type
@return self
Add view data