Test Failed
Pull Request — main (#59)
by Dimitri
06:14
created

BaseHandler::info()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 0
cts 1
cp 0
crap 2
rs 10
1
<?php
2
3
/**
4
 * This file is part of Blitz PHP framework.
5
 *
6
 * (c) 2022 Dimitri Sitchet Tomkeu <[email protected]>
7
 *
8
 * For the full copyright and license information, please view
9
 * the LICENSE file that was distributed with this source code.
10
 */
11
12
namespace BlitzPHP\Security\Hashing\Handlers;
13
14
use BlitzPHP\Contracts\Security\HasherInterface;
15
16
/**
17
 * Gestionnaire de hashage de base
18
 *
19
 * @credit <a href="http://www.laravel.com">Laravel 11 - \Illuminate\Hashing\AbstractHasher</a>
20
 */
21
abstract class BaseHandler implements HasherInterface
22
{
23
    /**
24
     * {@inheritDoc}
25
     */
26
    public function info(string $hashedValue): array
27
    {
28
        return password_get_info($hashedValue);
0 ignored issues
show
Bug Best Practice introduced by
The expression return password_get_info($hashedValue) could return the type null which is incompatible with the type-hinted return array. Consider adding an additional type-check to rule them out.
Loading history...
29
    }
30
31
    /**
32
     * {@inheritDoc}
33
     */
34
    public function check(string $value, string $hashedValue, array $options = []): bool
35
    {
36
        if ($hashedValue === '') {
37
            return false;
38
        }
39
40
        return password_verify($value, $hashedValue);
41
    }
42
}
43