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 ( b2b866...746f66 )
by Maximilian
03:24
created

PHPPasswordHasher::compareWith()   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 2
crap 1
1
<?php
2
3
namespace Ma27\ApiKeyAuthenticationBundle\Service\Password;
4
5
/**
6
 * Hasher implementation based on the `password_*` API introduced in PHP 5.5.
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
        $this->cost = (int) $cost;
23 1
    }
24
25
    /**
26
     * {@inheritdoc}
27
     */
28 1
    public function generateHash($password)
29
    {
30 1
        return password_hash($password, PASSWORD_BCRYPT, array('cost' => $this->cost));
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36 1
    public function compareWith($password, $raw)
37
    {
38 1
        return password_verify($raw, $password);
39
    }
40
}
41