GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( cb7f05...c88989 )
by Maximilian
09:13
created

CryptPasswordHasher::generateHash()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Ma27\ApiKeyAuthenticationBundle\Service\Password;
4
5
/**
6
 * Hasher which uses the crypt algorithm.
7
 */
8
class CryptPasswordHasher implements PasswordHasherInterface
9
{
10
    /**
11
     * {@inheritdoc}
12
     */
13 15
    public function generateHash($password)
14
    {
15 15
        return crypt($password, sprintf('$6$rounds=3000$%s$', $this->generateSalt()));
16
    }
17
18
    /**
19
     * {@inheritdoc}
20
     */
21 12
    public function compareWith($password, $raw)
22
    {
23 12
        return crypt($raw, $password) === $password;
24
    }
25
26
    /**
27
     * Generates a salt using the openssl API.
28
     *
29
     * @return string
30
     */
31 15
    protected function generateSalt()
32
    {
33 15
        return bin2hex(openssl_random_pseudo_bytes(10));
34
    }
35
}
36