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

UserTrait   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

1 Method

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