BcryptHasher::hash()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 2
1
<?php
2
3
namespace WZRD\Hashing;
4
5
use WZRD\Contracts\Hashing\Hasher;
6
7
class BcryptHasher implements Hasher
8
{
9
    /**
10
     * Hash the given value.
11
     *
12
     * @param string $value
13
     * @param array  $options
14
     *
15
     * @return string
16
     */
17
    public function hash($value, array $options = [])
18
    {
19
        return password_hash($value, PASSWORD_BCRYPT, $options);
20
    }
21
22
    /**
23
     * Check the given plain value against a hash.
24
     *
25
     * @param string $value
26
     * @param string $hash
27
     * @param array  $options
28
     *
29
     * @return bool
30
     */
31
    public function verify($value, $hash, array $options = [])
32
    {
33
        return (bool) password_verify($value, $hash);
34
    }
35
}
36