X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fcaxy%2Fphp-htmldiff%2Flib%2FCaxy%2FHtmlDiff%2FTable%2FTableRow.php;fp=vendor%2Fcaxy%2Fphp-htmldiff%2Flib%2FCaxy%2FHtmlDiff%2FTable%2FTableRow.php;h=13c46286ccabfd9ab349ba46ee7c0e478e11ce61;hp=0000000000000000000000000000000000000000;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad diff --git a/vendor/caxy/php-htmldiff/lib/Caxy/HtmlDiff/Table/TableRow.php b/vendor/caxy/php-htmldiff/lib/Caxy/HtmlDiff/Table/TableRow.php new file mode 100644 index 000000000..13c46286c --- /dev/null +++ b/vendor/caxy/php-htmldiff/lib/Caxy/HtmlDiff/Table/TableRow.php @@ -0,0 +1,105 @@ +table; + } + + /** + * @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; + } + + /** + * @return TableCell[] + */ + public function getCells() + { + return $this->cells; + } + + /** + * @param TableCell $cell + * + * @return $this + */ + public function addCell(TableCell $cell) + { + $this->cells[] = $cell; + + if (!$cell->getRow()) { + $cell->setRow($this); + } + + return $this; + } + + /** + * @param TableCell $cell + */ + public function removeCell(TableCell $cell) + { + $key = array_search($cell, $this->cells, true); + + if ($key !== false) { + unset($this->cells[$key]); + if ($cell->getRow()) { + $cell->setRow(null); + } + } + } + + /** + * @param int $index + * + * @return TableCell|null + */ + public function getCell($index) + { + return isset($this->cells[$index]) ? $this->cells[$index] : null; + } + + /** + * @param TableCell[] $cells + * @param null|int $position + */ + public function insertCells($cells, $position = null) + { + if ($position === null) { + $this->cells = array_merge($this->cells, $cells); + } else { + array_splice($this->cells, $position, 0, $cells); + } + } +}