Completed
Pull Request — master (#19)
by Pierre
04:14
created

BCryptAwareWrapper::generate()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 11
rs 9.4285
c 1
b 0
f 0
cc 2
eloc 6
nc 2
nop 0
1
<?php
2
3
namespace Knp\Rad\User\Salt\Generator;
4
5
use Knp\Rad\User\Salt\Generator;
6
7
class BCryptAwareWrapper implements Generator
8
{
9
    /**
10
     * @var Generator
11
     */
12
    private $wrapped;
13
14
    /**
15
     * @param Generator $wrapped
16
     */
17
    public function __construct(Generator $wrapped)
18
    {
19
        $this->wrapped = $wrapped;
20
    }
21
22
    /**
23
     * {@inheritdoc}
24
     */
25
    public function generate()
26
    {
27
        if (function_exists('password_hash')) {
28
            trigger_error(
29
                'BCrypt and the function password_hash are supported by your PHP version. The salt system is deprecated.',
30
                E_USER_DEPRECATED
31
            );
32
        }
33
34
        $this->wrapped->generate();
35
    }
36
}
37