MD5Hasher::make()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 3
nc 2
nop 2
crap 2
1
<?php
2
namespace FirstShuai\Hasher;
3
/**
4
 * Created by PhpStorm.
5
 * User: FirstShuai
6
 * Date: 2016/10/28
7
 * Time: 下午3:09
8
 */
9
class MD5Hasher
10
{
11 1
    public function make($value, array $options = [])
12
    {
13 1
        $salt = isset($options['salt']) ? $options['salt'] : '';
14 1
        return md5($value . $salt);
15
    }
16
17
    public function check($value, $hasherValer, array $options = [])
18
    {
19
        $salt = isset($options['salt']) ? $options['salt'] : '';
20
        return $hasherValer === md5($value . $salt);
21
    }
22
}