ClassicMergeSourceDetector::detect()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 3
c 0
b 0
f 0
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 10
cc 2
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\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