Completed
Push — master ( 9628d6...a206dc )
by Derek Stephen
09:38
created

User::toArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
ccs 0
cts 0
cp 0
cc 1
eloc 4
nc 1
nop 0
crap 2
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: DM0C60544
5
 * Date: 21/3/2017
6
 * Time: 4:17 PM
7
 */
8
9
namespace OAuth;
10
11
use Del\Entity\User as UserEntity;
12
use OAuth\Traits\EncryptableFieldEntity;
13
14
/**
15
 * @MappedSuperclass(repositoryClass="OAuth\Repository\UserRepository")
16
 */
17
class User extends UserEntity
18
{
19
    use EncryptableFieldEntity;
20
21
    /**
22 1
     * Set password
23
     *
24 1
     * @param string $password
25
     * @return User
26
     */
27
    public function setPassword($password)
28
    {
29
        $password = $this->encryptField($password);
30
        parent::setPassword($password);
31
        return $this;
32
    }
33
34
    /**
35
     * Verify user's password
36
     *
37
     * @param string $password
38
     * @return Boolean
39
     */
40
    public function verifyPassword($password)
41
    {
42
        return $this->verifyEncryptedFieldValue($this->getPassword(), $password);
43
    }
44
45
    /**
46
     * @return array
47
     */
48
    public function toArray()
49
    {
50
        return [
51
            'user_id' => $this->getID(),
52
            'scope' => null,
53
        ];
54
    }
55
}