Completed
Push — master ( 67fdac...838896 )
by giu
38s
created

User::_setPassword()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
namespace App\Model\Entity;
3
4
use Cake\Auth\DefaultPasswordHasher;
5
use Cake\ORM\Entity;
6
7
/**
8
 * User Entity
9
 *
10
 * @property int $id
11
 * @property string $email
12
 * @property string $password
13
 * @property \Cake\I18n\Time $created
14
 * @property \Cake\I18n\Time $modified
15
 */
16
class User extends Entity
17
{
18
19
    /**
20
     * Fields that can be mass assigned using newEntity() or patchEntity().
21
     *
22
     * Note that when '*' is set to true, this allows all unspecified fields to
23
     * be mass assigned. For security purposes, it is advised to set '*' to false
24
     * (or remove it), and explicitly make individual fields accessible as needed.
25
     *
26
     * @var array
27
     */
28
    protected $_accessible = [
29
        '*' => true,
30
        'id' => false
31
    ];
32
33
    /**
34
     * Fields that are excluded from JSON versions of the entity.
35
     *
36
     * @var array
37
     */
38
    protected $_hidden = [
39
        'password'
40
    ];
41
	
42 2
	protected function _setPassword($password)
43
    {
44 2
        return (new DefaultPasswordHasher)->hash($password);
45
    }
46
}
47