header = $header;
}
public function addRow($row)
{
$this->rows[] = $row;
}
public function getHtml()
{
if(!$this->header) {
return '';
}
$table = '
';
foreach ($this->header as $key => $heading) {
$table .= '| '.wp_kses_post($heading).' | ';
}
$table .= '
';
foreach ($this->rows as $row) {
$table .= '';
foreach ($this->header as $key => $heading) {
$table .= '| '.Arr::get($row, $key).' | ';
}
$table .= '
';
}
$table .= '
';
return $table;
}
public function printHtml()
{
echo $this->getHtml(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
public function reset()
{
$this->header = [];
$this->rows = [];
$this->tableClass = 'fc_horizontal_table';
}
}