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

BaseHandler   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 20
ccs 0
cts 3
cp 0
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A info() 0 3 1
A check() 0 7 2
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