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.

WordPressHasher::check()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
c 1
b 0
f 0
nc 2
nop 3
dl 0
loc 9
rs 10
1
<?php
2
3
namespace MrShan0\WordpressAuth\Hashing;
4
5
use Hautelook\Phpass\PasswordHash;
6
use Illuminate\Contracts\Hashing\Hasher;
7
use Illuminate\Hashing\AbstractHasher;
8
9
class WordPressHasher extends AbstractHasher implements Hasher
10
{
11
    protected $hasher;
12
13
    public function __construct(PasswordHash $hasher)
14
    {
15
        $this->hasher = $hasher;
16
    }
17
18
    /**
19
     * Hash the given value.
20
     *
21
     * @param  string  $value
22
     * @param  array   $options
23
     * @return string
24
     */
25
    public function make($value, array $options = array())
26
    {
27
        return $this->hasher->HashPassword($value);
28
    }
29
30
    /**
31
     * Check the given plain value against a hash.
32
     *
33
     * @param  string  $value
34
     * @param  string  $hashedValue
35
     * @param  array   $options
36
     * @return bool
37
     */
38
    public function check($value, $hashedValue, array $options = array())
39
    {
40
        if ( strlen($hashedValue) <= 32 ) {
41
            return $hashedValue == md5($value);
42
        }
43
44
        $check = $this->hasher->CheckPassword($value, $hashedValue);
45
46
        return $check;
47
    }
48
49
    /**
50
     * Check if the given hash has been hashed using the given options.
51
     *
52
     * @param  string  $hashedValue
53
     * @param  array   $options
54
     * @return bool
55
     */
56
    public function needsRehash($hashedValue, array $options = array())
57
    {
58
        return false;
59
    }
60
}
61