*/ private $rows = []; /** * Number of columns. * * @var int */ private $columnCount = 1; /** * Create a new \PhpOffice\PhpPresentation\Shape\Table instance. * * @param int $columns Number of columns */ public function __construct($columns = 1) { $this->columnCount = $columns; // Initialize parent parent::__construct(); // No resize proportional $this->resizeProportional = false; } /** * Get row. * * @param int $row Row number * * @throws OutOfBoundsException */ public function getRow(int $row = 0): Row { if (!isset($this->rows[$row])) { throw new OutOfBoundsException( 0, (\count($this->rows) - 1) < 0 ? 0 : \count($this->rows) - 1, $row ); } return $this->rows[$row]; } /** * @param int $row * * @return bool */ public function hasRow(int $row): bool { return isset($this->rows[$row]); } /** * Get rows. * * @return Row[] */ public function getRows(): array { return $this->rows; } /** * Create row. * * @return Row */ public function createRow(): Row { $row = new Row($this->columnCount); $this->rows[] = $row; return $row; } /** * @return int */ public function getNumColumns(): int { return $this->columnCount; } /** * @param int $numColumn * * @return self */ public function setNumColumns(int $numColumn): self { $this->columnCount = $numColumn; return $this; } /** * Get hash code. * * @return string Hash code */ public function getHashCode(): string { $hashElements = ''; foreach ($this->rows as $row) { $hashElements .= $row->getHashCode(); } return \md5($hashElements . __CLASS__); } }