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

PHPPasswordHasher::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
 * Concrete hasher that uses the php 5.5 api.
7
 */
8
class PHPPasswordHasher implements PasswordHasherInterface
9
{
10
    /**
11
     * @var int
12
     */
13
    private $cost;
14
15
    /**
16
     * Constructor.
17
     *
18
     * @param int $cost
19
     */
20 1
    public function __construct($cost = 12)
21
    {
22 1
        if (!function_exists('password_hash')) {
23
            throw new \RuntimeException(
24
                'In order to use this strategy please install the package "ircmaxell/password-compat" '.
25
                'or upgrade your php version to 5.5 or higher!'
26
            );
27
        }
28
29 1
        $this->cost = (int) $cost;
30 1
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35 1
    public function generateHash($password)
36
    {
37 1
        return password_hash($password, PASSWORD_BCRYPT, array('cost' => $this->cost));
38
    }
39
40
    /**
41
     * {@inheritdoc}
42
     */
43 1
    public function compareWith($password, $raw)
44
    {
45 1
        return password_verify($raw, $password);
46
    }
47
}
48