+ /**
+ * returns the number of new (added) lines in a given diff.
+ *
+ * @since Text_Diff 1.1.0
+ *
+ * @return integer The number of new lines
+ */
+ function countAddedLines()
+ {
+ $count = 0;
+ foreach ($this->_edits as $edit) {
+ if (is_a($edit, 'Text_Diff_Op_add') ||
+ is_a($edit, 'Text_Diff_Op_change')) {
+ $count += $edit->nfinal();
+ }
+ }
+ return $count;
+ }
+
+ /**
+ * Returns the number of deleted (removed) lines in a given diff.
+ *
+ * @since Text_Diff 1.1.0
+ *
+ * @return integer The number of deleted lines
+ */
+ function countDeletedLines()
+ {
+ $count = 0;
+ foreach ($this->_edits as $edit) {
+ if (is_a($edit, 'Text_Diff_Op_delete') ||
+ is_a($edit, 'Text_Diff_Op_change')) {
+ $count += $edit->norig();
+ }
+ }
+ return $count;
+ }
+