Completed
Push — master ( 446472...7ef246 )
by Lukas
02:50
created

Helper::convertHSLToRGB()   F

Complexity

Conditions 20
Paths 896

Size

Total Lines 81
Code Lines 68

Duplication

Lines 30
Ratio 37.04 %

Code Coverage

Tests 0
CRAP Score 420

Importance

Changes 0
Metric Value
dl 30
loc 81
ccs 0
cts 76
cp 0
rs 2.4691
c 0
b 0
f 0
cc 20
eloc 68
nc 896
nop 3
crap 420

How to fix   Long Method    Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
/**
3
 * ownCloud - Richdocuments App
4
 *
5
 * @author Victor Dubiniuk
6
 * @copyright 2013 Victor Dubiniuk [email protected]
7
 *
8
 * This file is licensed under the Affero General Public License version 3 or
9
 * later.
10
 */
11
12
namespace OCA\Richdocuments;
13
14
class Helper {
15
	const APP_ID = 'richdocuments';
16
17
	public static function getNewFileName($view, $path, $prepend = ' '){
18
		$fileNum = 1;
19
20
		while ($view->file_exists($path)){
21
			$fileNum += 1;
22
			$path = preg_replace('/(\.|' . $prepend . '\(\d+\)\.)([^.]*)$/', $prepend . '(' . $fileNum . ').$2', $path);
23
		};
24
25
		return $path;
26
	}
27
}
28