/** * Add/get row */ public function testRow() { $oTable = new Table(); $element = $oTable->addRow(); $this->assertInstanceOf('PhpOffice\\PhpWord\\Element\\Row', $element); $this->assertCount(1, $oTable->getRows()); }
/** * @param Table|null $table * * @return $this */ public function setTable(Table $table = null) { $this->table = $table; if ($table && !in_array($this, $table->getRows())) { $table->addRow($this); } return $this; }
/** * {@inheritDoc} */ public function getCells(array $groups = array()) { $cells = array(); foreach ($this->table->getRows() as $row) { if (!isset($row[$this->key])) { continue; } $cell = $row[$this->key]; foreach ($groups as $group) { if (!in_array($group, $cell->getGroups())) { continue 2; } } $cells[] = $cell; } return $cells; }