Passed
Push — master ( 47e37b...2360ce )
by Aimeos
05:11
created

Md5::reverse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Aimeos (aimeos.org), 2019
6
 * @package MW
7
 * @subpackage Common
8
 */
9
10
11
namespace Aimeos\MW\Criteria\Plugin;
12
13
14
/**
15
 * Criteria plugin for MD5 hashing
16
 *
17
 * @package MW
18
 * @subpackage Common
19
 */
20
class Md5 implements \Aimeos\MW\Criteria\Plugin\Iface
21
{
22
	/**
23
	 * Generates a MD5 hash
24
	 *
25
	 * @param mixed $value Value to translate
26
	 * @return mixed Translated value
27
	 */
28
	public function translate( $value )
29
	{
30
		if( is_array( $value ) )
31
		{
32
			foreach( $value as $key => $str ) {
33
				$value[$key] = md5( $str );
34
			}
35
36
			return $value;
37
		}
38
39
		return md5( $value );
40
	}
41
42
43
	/**
44
	 * Reverses cutting the value
45
	 *
46
	 * @param mixed $value Value to reverse
47
	 * @return mixed Reversed translation
48
	 */
49
	public function reverse( $value )
50
	{
51
		return $value;
52
	}
53
}
54