UserTrait::setPassword()   A
last analyzed

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 Mouf\Security\DAO;
4
5
/**
6
 * This trait changes the behaviour of the "setPassword" method on the user bean.
7
 * It is used to automatically encrypt the password.
8
 */
9
trait UserTrait
10
{
11
    /**
12
     * Sets the password.
13
     * Note: this will encode the password.
14
     *
15
     * @param string $password
16
     */
17
    public function setPassword(string $password)
18
    {
19
        parent::setPassword(password_hash($password, PASSWORD_DEFAULT));
20
    }
21
}
22