Completed
Push — master ( 6988d9...4c3717 )
by kong
02:09
created

MD5hash   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 25
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A make() 0 5 2
A check() 0 3 1
1
<?php
2
3
namespace Maxfine\Hasher;
4
5
class MD5hash
6
{
7
    /**
8
     * @param       $value
9
     * @param array $options
10
     *
11
     * @return string
12
     */
13 4
    public function make($value, array $options = [])
14
    {
15 4
        $salt = isset($options['salt']) ? $options['salt'] : '';
16
17 4
        return hash('md5', $value . $salt);
18
    }
19
20
    /**
21
     * @param       $value
22
     * @param       $hashValue
23
     * @param array $options
24
     *
25
     * @return bool
26
     */
27 2
    public function check($value, $hashValue, array $options = [])
28
    {
29 2
        return $hashValue === $this->make($value, $options);
30
    }
31
}
32
33