Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
1.4 kB
1
Indexable
Never
<?php


class Row {
    private array $values;

    public function __construct(array $values)
    {
        $this->values=$values;
    }
    public function len(){
        return count($this->values);
    }
    public function getValues(){

    }
}

class Table {
    private array $rows;
    private Row $header;
    private array $cellClasse;
    private array $headerClasses;
    private array $tableClasses;

    public function __construct(Row $header)
    {
        $this->header = $header;
    }

    public function addRow(Row $row)
    {
        if($this->header->len()==$row->len()){
            $this->rows[] = $row;
        }
        return $this;
    }

    public function switchRows(int $a, int $b)
    {
      $temp = $this->rows[$a];
      $this->rows[$a] = $this->rows[$b];
      $this->rows[$b] = $temp;
      return $this;
    }

    public function setCellClasses(array $classes)
    {
        $this->cellClasse = $classes;
    }

    public function setHeaderClasses(array $classes)
    {
        $this->headerClasse = $classes;
    }

    public function setTableClasses(array $classes)
    {
        $this->tableClasse = $classes;
    }

    public function toHTML() 
    {
        $str='';
        foreach()

        foreach($this->rows as $row){
            
        }
    }
}