Completed
Push — master ( c16260...319f0f )
by cam
05:07
created

nanoSha2::ordUTF8()   B

Complexity

Conditions 10
Paths 7

Size

Total Lines 49

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 10
nc 7
nop 3
dl 0
loc 49
rs 7.246
c 0
b 0
f 0

How to fix   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
/**
4
 * Main routine called from an application using this include.
5
 *
6
 * General usage:
7
 *   require_once('sha256.inc.php');
8
 *   $hashstr = spip_sha256('abc');
9
 *
10
 * @param string $str Chaîne dont on veut calculer le SHA
11
 * @return string Le SHA de la chaîne
12
 */
13
function spip_sha256($str) {
14
	return hash('sha256', $str);
15
}
16
17
/**
18
 * @param string $str Chaîne dont on veut calculer le SHA
19
 * @param bool $ig_func
20
 * @return string Le SHA de la chaîne
21
 * @deprecated
22
 */
23
function _nano_sha256($str, $ig_func = true) {
0 ignored issues
show
Unused Code introduced by
The parameter $ig_func is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
24
	return spip_sha256($str);
25
}
26
27
// 2009-07-23: Added check for function as the Suhosin plugin adds this routine.
28
if (!function_exists('sha256')) {
29
	/**
30
	 * Calcul du SHA256
31
	 *
32
	 * @param string $str Chaîne dont on veut calculer le SHA
33
	 * @param bool $ig_func
34
	 * @return string Le SHA de la chaîne
35
	 * @deprecated
36
	 */
37
	function sha256($str, $ig_func = true) { return spip_sha256($str); }
0 ignored issues
show
Unused Code introduced by
The parameter $ig_func is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
38
}