From: Chuck Hagenbuch Date: Wed, 24 Nov 2010 15:32:49 +0000 (-0500) Subject: Helper methods for getting the number of added and deleted lines on a patchset withou... X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=17a425ec99e210e7e614e43a3900c17760793f85;p=horde.git Helper methods for getting the number of added and deleted lines on a patchset without having to know the internals of the patchset object. --- diff --git a/framework/Vcs/lib/Horde/Vcs/Log.php b/framework/Vcs/lib/Horde/Vcs/Log.php index 6645db71f..139070166 100644 --- a/framework/Vcs/lib/Horde/Vcs/Log.php +++ b/framework/Vcs/lib/Horde/Vcs/Log.php @@ -152,4 +152,28 @@ abstract class Horde_Vcs_Log ? $this->_files : (isset($this->_files[$file]) ? $this->_files[$file] : array()); } + + public function getAddedLines() + { + $this->_ensureInitialized(); + $lines = 0; + foreach ($this->_files as $file) { + if (isset($file['added'])) { + $lines += $file['added']; + } + } + return $lines; + } + + public function getDeletedLines() + { + $this->_ensureInitialized(); + $lines = 0; + foreach ($this->_files as $file) { + if (isset($file['deleted'])) { + $lines += $file['deleted']; + } + } + return $lines; + } }