From 01fb5a50c435c8ae5631e95cd84a287fcdf68e65 Mon Sep 17 00:00:00 2001 From: Andrew Roslik Date: Tue, 1 Dec 2015 20:00:44 +0200 Subject: [PATCH] #13 Implement integration with GitHub - Added getting class name of parser of short message.. --- LibHooks/lib/PreCommit/Filter/ShortCommitMsg.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/LibHooks/lib/PreCommit/Filter/ShortCommitMsg.php b/LibHooks/lib/PreCommit/Filter/ShortCommitMsg.php index d7d33b2..0626029 100644 --- a/LibHooks/lib/PreCommit/Filter/ShortCommitMsg.php +++ b/LibHooks/lib/PreCommit/Filter/ShortCommitMsg.php @@ -64,7 +64,10 @@ protected function _getFormatterConfig() */ protected function _getParser() { - return new ShortCommitMsg\Jira\Parser(); + $class = $this->_getConfig()->getNode( + 'tracker/' . $this->_getTrackerType() . '/message/parser/class' + ); + return new $class; } /** @@ -98,4 +101,14 @@ protected function _getConfig() { return Config::getInstance(); } + + /** + * Get tracker type + * + * @return string + */ + protected function _getTrackerType() + { + return (string)$this->_getConfig()->getNode('tracker/type'); + } }