X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fcaxy%2Fphp-htmldiff%2Flib%2FCaxy%2FHtmlDiff%2FTable%2FDiffRowPosition.php;fp=vendor%2Fcaxy%2Fphp-htmldiff%2Flib%2FCaxy%2FHtmlDiff%2FTable%2FDiffRowPosition.php;h=3e05841cf1c941acb2934cfb4c0f63c2bbca5d24;hp=0000000000000000000000000000000000000000;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad diff --git a/vendor/caxy/php-htmldiff/lib/Caxy/HtmlDiff/Table/DiffRowPosition.php b/vendor/caxy/php-htmldiff/lib/Caxy/HtmlDiff/Table/DiffRowPosition.php new file mode 100644 index 000000000..3e05841cf --- /dev/null +++ b/vendor/caxy/php-htmldiff/lib/Caxy/HtmlDiff/Table/DiffRowPosition.php @@ -0,0 +1,267 @@ +indexInOld = $indexInOld; + $this->indexInNew = $indexInNew; + $this->columnInOld = $columnInOld; + $this->columnInNew = $columnInNew; + } + + /** + * @return int + */ + public function getIndexInOld() + { + return $this->indexInOld; + } + + /** + * @param int $indexInOld + * + * @return DiffRowPosition + */ + public function setIndexInOld($indexInOld) + { + $this->indexInOld = $indexInOld; + + return $this; + } + + /** + * @return int + */ + public function getIndexInNew() + { + return $this->indexInNew; + } + + /** + * @param int $indexInNew + * + * @return DiffRowPosition + */ + public function setIndexInNew($indexInNew) + { + $this->indexInNew = $indexInNew; + + return $this; + } + + /** + * @return int + */ + public function getColumnInOld() + { + return $this->columnInOld; + } + + /** + * @param int $columnInOld + * + * @return DiffRowPosition + */ + public function setColumnInOld($columnInOld) + { + $this->columnInOld = $columnInOld; + + return $this; + } + + /** + * @return int + */ + public function getColumnInNew() + { + return $this->columnInNew; + } + + /** + * @param int $columnInNew + * + * @return DiffRowPosition + */ + public function setColumnInNew($columnInNew) + { + $this->columnInNew = $columnInNew; + + return $this; + } + + /** + * @param int $increment + * + * @return int + */ + public function incrementColumnInNew($increment = 1) + { + $this->columnInNew += $increment; + + return $this->columnInNew; + } + + /** + * @param int $increment + * + * @return int + */ + public function incrementColumnInOld($increment = 1) + { + $this->columnInOld += $increment; + + return $this->columnInOld; + } + + /** + * @param int $increment + * + * @return int + */ + public function incrementIndexInNew($increment = 1) + { + $this->indexInNew += $increment; + + return $this->indexInNew; + } + + /** + * @param int $increment + * + * @return int + */ + public function incrementIndexInOld($increment = 1) + { + $this->indexInOld += $increment; + + return $this->indexInOld; + } + + /** + * @param string $type + * @param int $increment + * + * @return int + */ + public function incrementIndex($type, $increment = 1) + { + if ($type === 'new') { + return $this->incrementIndexInNew($increment); + } + + return $this->incrementIndexInOld($increment); + } + + /** + * @param string $type + * @param int $increment + * + * @return int + */ + public function incrementColumn($type, $increment = 1) + { + if ($type === 'new') { + return $this->incrementColumnInNew($increment); + } + + return $this->incrementColumnInOld($increment); + } + + /** + * @param string $type + * + * @return bool + */ + public function isColumnLessThanOther($type) + { + if ($type === 'new') { + return $this->getColumnInNew() < $this->getColumnInOld(); + } + + return $this->getColumnInOld() < $this->getColumnInNew(); + } + + /** + * @param string $type + * + * @return int + */ + public function getColumn($type) + { + if ($type === 'new') { + return $this->getColumnInNew(); + } + + return $this->getColumnInOld(); + } + + /** + * @param string $type + * + * @return int + */ + public function getIndex($type) + { + if ($type === 'new') { + return $this->getIndexInNew(); + } + + return $this->getIndexInOld(); + } + + /** + * @return bool + */ + public function areColumnsEqual() + { + return $this->getColumnInOld() === $this->getColumnInNew(); + } + + /** + * @return null|string + */ + public function getLesserColumnType() + { + if ($this->isColumnLessThanOther('new')) { + return 'new'; + } elseif ($this->isColumnLessThanOther('old')) { + return 'old'; + } + + return; + } +}