Completed
Push — master ( 56fa23...318c5e )
by Alexander
02:56
created

LogMessageParserFactory::getLogMessageParser()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 9.4285
cc 2
eloc 4
nc 2
nop 1
crap 2
1
<?php
2
/**
3
 * This file is part of the SVN-Buddy library.
4
 * For the full copyright and license information, please view
5
 * the LICENSE file that was distributed with this source code.
6
 *
7
 * @copyright Alexander Obuhovich <[email protected]>
8
 * @link      https://github.com/console-helpers/svn-buddy
9
 */
10
11
namespace ConsoleHelpers\SVNBuddy\Repository\Parser;
12
13
14
class LogMessageParserFactory
15
{
16
17
	/**
18
	 * Log message parsers.
19
	 *
20
	 * @var LogMessageParser[]
21
	 */
22
	private $_parsers = array();
23
24
	/**
25
	 * Returns log message parser.
26
	 *
27
	 * @param string $bugtraq_logregex Regular expression(-s) for bug id finding in log message.
28
	 *
29
	 * @return LogMessageParser
30
	 */
31 3
	public function getLogMessageParser($bugtraq_logregex)
32
	{
33 3
		if ( !isset($this->_parsers[$bugtraq_logregex]) ) {
34 3
			$this->_parsers[$bugtraq_logregex] = new LogMessageParser($bugtraq_logregex);
35 3
		}
36
37 3
		return $this->_parsers[$bugtraq_logregex];
38
	}
39
40
}
41