UserTrait   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 0
loc 13
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A setPassword() 0 4 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