1+ <?php
2+
3+ namespace RetargetingSDK ;
4+
5+ use RetargetingSDK \Helpers \EmailHelper ;
6+
7+ /**
8+ * Class Customer
9+ * @package RetargetingSDK
10+ */
11+ class Customer extends AbstractRetargetingSDK
12+ {
13+ /**
14+ * @var string
15+ */
16+ protected $ firstName ;
17+
18+ /**
19+ * @var string
20+ */
21+ protected $ lastName ;
22+
23+ /**
24+ * @var string
25+ */
26+ protected $ email ;
27+
28+ /**
29+ * @var string
30+ */
31+ protected $ phone ;
32+
33+ /**
34+ * @var boolean
35+ */
36+ protected $ status ;
37+
38+ /**
39+ * @return string
40+ */
41+ public function getFirstName ()
42+ {
43+ return $ this ->firstName ;
44+ }
45+
46+ /**
47+ * @param string $firstName
48+ */
49+ public function setFirstName ($ firstName )
50+ {
51+ $ this ->firstName = $ this ->getProperFormattedString ($ firstName );
52+ }
53+
54+ /**
55+ * @return string
56+ */
57+ public function getLastName ()
58+ {
59+ return $ this ->lastName ;
60+ }
61+
62+ /**
63+ * @param string $lastName
64+ */
65+ public function setLastName ($ lastName )
66+ {
67+ $ this ->lastName = $ this ->getProperFormattedString ($ lastName );
68+ }
69+
70+ /**
71+ * @return string
72+ */
73+ public function getEmail ()
74+ {
75+ return $ this ->email ;
76+ }
77+
78+ /**
79+ * @param $email
80+ * @throws \Exception
81+ */
82+ public function setEmail ($ email )
83+ {
84+ $ this ->email = EmailHelper::validate ($ email );
85+ }
86+
87+ /**
88+ * @return string
89+ */
90+ public function getPhone ()
91+ {
92+ return $ this ->phone ;
93+ }
94+
95+ /**
96+ * @param string $phone
97+ */
98+ public function setPhone ($ phone )
99+ {
100+ $ this ->phone = $ this ->getProperFormattedString ($ phone );
101+ }
102+
103+ /**
104+ * @return bool
105+ */
106+ public function getStatus ()
107+ {
108+ return $ this ->status ;
109+ }
110+
111+ /**
112+ * @param bool $status
113+ */
114+ public function setStatus ($ status )
115+ {
116+ $ this ->status = is_bool ($ status ) ? $ status : false ;
117+ }
118+
119+ /**
120+ * @param bool $encoded
121+ * @return array|string
122+ */
123+ public function getData ($ encoded = true )
124+ {
125+ $ data = [
126+ 'firstname ' => $ this ->getFirstName (),
127+ 'lastname ' => $ this ->getLastName (),
128+ 'email ' => $ this ->getEmail (),
129+ 'phone ' => $ this ->getPhone (),
130+ 'status ' => $ this ->getStatus ()
131+ ];
132+
133+ return $ encoded ? $ this ->toJSON ($ data ) : $ data ;
134+ }
135+ }
0 commit comments