ClassicMergeSourceDetector   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 4
c 0
b 0
f 0
dl 0
loc 18
ccs 4
cts 4
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A detect() 0 8 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\MergeSourceDetector;
12
13
14
class ClassicMergeSourceDetector extends AbstractMergeSourceDetector
15
{
16
17
	/**
18
	 * Detects merge source from repository url.
19
	 *
20
	 * @param string $repository_url Repository url.
21
	 *
22
	 * @return null|string
23
	 */
24 9
	public function detect($repository_url)
25
	{
26
		// Merging "trunk" into "stable" or other tag.
27 9
		if ( preg_match('#^(.*)/tags/(.*)$#', $repository_url, $regs) ) {
28 2
			return $regs[1] . '/trunk';
29
		}
30
31 7
		return null;
32
	}
33
34
}
35