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   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 33
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A generateHash() 0 4 1
A compareWith() 0 4 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