Passed
Push — 1.0 ( a8ebf2...3632bb )
by David
02:59
created

UserTrait::setPassword()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
4
namespace Mouf\Security\DAO;
5
6
/**
7
 * This trait changes the behaviour of the "setPassword" method on the user bean.
8
 * It is used to automatically encrypt the password.
9
 */
10
trait UserTrait
11
{
12
    /**
13
     * Sets the password.
14
     * Note: this will encode the password.
15
     *
16
     * @param string $password
17
     */
18
    public function setPassword(string $password)
19
    {
20
        parent::setPassword(password_hash($password, PASSWORD_DEFAULT));
21
    }
22
}
23