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
Branch develop (0737e3)
by Maximilian
11:49
created

PHPPasswordHasher::generateHash()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 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
    public function __construct($cost = 12)
21
    {
22
        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
        $this->cost = (int) $cost;
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    public function generateHash($password)
36
    {
37
        return password_hash($password, PASSWORD_BCRYPT, array('cost' => $this->cost));
0 ignored issues
show
Comprehensibility Best Practice introduced by
The expression password_hash($password,...cost' => $this->cost)); of type null|false|string adds false to the return on line 37 which is incompatible with the return type declared by the interface Ma27\ApiKeyAuthenticatio...Interface::generateHash of type string. It seems like you forgot to handle an error condition.
Loading history...
38
    }
39
40
    /**
41
     * {@inheritdoc}
42
     */
43
    public function compareWith($password, $raw)
44
    {
45
        return password_verify($raw, $password);
46
    }
47
}
48