Completed
Push — master ( 66631d...a00063 )
by
unknown
9s
created

User::setEmail()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 6
rs 9.4285
ccs 3
cts 3
cp 1
cc 1
eloc 3
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Xsolla\SDK\Webhook;
4
5
use Xsolla\SDK\API\XsollaClient;
6
7
class User
8
{
9
    protected $id;
10
    protected $publicId;
11
    protected $name;
12
    protected $email;
13
    protected $phone;
14
15 5
    public function getId()
16
    {
17 5
        return $this->id;
18
    }
19
20 4
    public function setId($id)
21
    {
22 4
        $this->id = $id;
23
24 4
        return $this;
25
    }
26
27
    public function getPublicId()
28
    {
29
        return $this->publicId;
30
    }
31
32 1
    public function setPublicId($publicId)
33
    {
34 1
        $this->publicId = $publicId;
35
36 1
        return $this;
37
    }
38
39
    public function getName()
40
    {
41
        return $this->name;
42
    }
43
44 1
    public function setName($name)
45
    {
46 1
        $this->name = $name;
47
48 1
        return $this;
49
    }
50
51
    public function getEmail()
52
    {
53
        return $this->email;
54
    }
55
56 1
    public function setEmail($email)
57
    {
58 1
        $this->email = $email;
59
60 1
        return $this;
61
    }
62
63
    public function getPhone()
64
    {
65
        return $this->phone;
66
    }
67
68 1
    public function setPhone($phone)
69
    {
70 1
        $this->phone = $phone;
71
72 1
        return $this;
73
    }
74
75 2
    public function toJson()
76
    {
77 2
        $response = array();
78 2
        if ($this->id) {
79 2
            $response['id'] = $this->id;
80
        }
81 2
        if ($this->name) {
82 1
            $response['name'] = $this->name;
83
        }
84 2
        if ($this->publicId) {
85 1
            $response['public_id'] = $this->publicId;
86
        }
87 2
        if ($this->email) {
88 1
            $response['email'] = $this->email;
89
        }
90 2
        if ($this->phone) {
91 1
            $response['phone'] = $this->phone;
92
        }
93
94 2
        return XsollaClient::jsonEncode(array('user' => $response));
95
    }
96
}
97