MD5hash::make()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 2
nc 2
nop 2
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 2
rs 10
c 0
b 0
f 0
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