1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AlexisLefebvre\Bundle\AsyncTweetsBundle\Entity; |
4
|
|
|
|
5
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* User |
9
|
|
|
*/ |
10
|
|
|
class User |
11
|
|
|
{ |
12
|
|
|
/** |
13
|
|
|
* @var bigint |
14
|
|
|
*/ |
15
|
|
|
private $id; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @var string |
19
|
|
|
*/ |
20
|
|
|
private $name; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @var string |
24
|
|
|
*/ |
25
|
|
|
private $screen_name; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @var string |
29
|
|
|
*/ |
30
|
|
|
private $profile_image_url; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @var string |
34
|
|
|
*/ |
35
|
|
|
private $profile_image_url_https; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @var ArrayCollection |
39
|
|
|
*/ |
40
|
|
|
private $tweets; |
41
|
|
|
|
42
|
9 |
|
public function __construct($id = null) |
43
|
|
|
{ |
44
|
9 |
|
if (! is_null($id)) { |
45
|
4 |
|
$this->setId($id); |
46
|
4 |
|
} |
47
|
|
|
|
48
|
9 |
|
$this->tweets = new ArrayCollection(); |
49
|
9 |
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Set id |
53
|
|
|
* |
54
|
|
|
* @param bigint $id |
55
|
|
|
* @return User |
56
|
|
|
*/ |
57
|
9 |
|
public function setId($id) |
58
|
|
|
{ |
59
|
9 |
|
$this->id = $id; |
60
|
|
|
|
61
|
9 |
|
return $this; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* Get id |
66
|
|
|
* |
67
|
|
|
* @return integer |
68
|
|
|
*/ |
69
|
1 |
|
public function getId() |
70
|
|
|
{ |
71
|
1 |
|
return $this->id; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* Set name |
76
|
|
|
* |
77
|
|
|
* @param string $name |
78
|
|
|
* @return User |
79
|
|
|
*/ |
80
|
9 |
|
public function setName($name) |
81
|
|
|
{ |
82
|
9 |
|
$this->name = $name; |
83
|
|
|
|
84
|
9 |
|
return $this; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* Get name |
89
|
|
|
* |
90
|
|
|
* @return string |
91
|
|
|
*/ |
92
|
10 |
|
public function getName() |
93
|
|
|
{ |
94
|
10 |
|
return $this->name; |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* Set screen_name |
99
|
|
|
* |
100
|
|
|
* @param string $screenName |
101
|
|
|
* @return User |
102
|
|
|
*/ |
103
|
9 |
|
public function setScreenName($screenName) |
104
|
|
|
{ |
105
|
9 |
|
$this->screen_name = $screenName; |
106
|
|
|
|
107
|
9 |
|
return $this; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* Get screen_name |
112
|
|
|
* |
113
|
|
|
* @return string |
114
|
|
|
*/ |
115
|
7 |
|
public function getScreenName() |
116
|
|
|
{ |
117
|
7 |
|
return $this->screen_name; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* Set profile_image_url |
122
|
|
|
* |
123
|
|
|
* @param string $profileImageUrl |
124
|
|
|
* @return User |
125
|
|
|
*/ |
126
|
1 |
|
public function setProfileImageUrl($profileImageUrl) |
127
|
|
|
{ |
128
|
1 |
|
$this->profile_image_url = $profileImageUrl; |
129
|
|
|
|
130
|
1 |
|
return $this; |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
/** |
134
|
|
|
* Get profile_image_url |
135
|
|
|
* |
136
|
|
|
* @return string |
137
|
|
|
*/ |
138
|
2 |
|
public function getProfileImageUrl() |
139
|
|
|
{ |
140
|
2 |
|
return $this->profile_image_url; |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* Set profile_image_url_https |
145
|
|
|
* |
146
|
|
|
* @param string $profileImageUrlHttps |
147
|
|
|
* @return User |
148
|
|
|
*/ |
149
|
8 |
|
public function setProfileImageUrlHttps($profileImageUrlHttps) |
150
|
|
|
{ |
151
|
8 |
|
$this->profile_image_url_https = $profileImageUrlHttps; |
152
|
|
|
|
153
|
8 |
|
return $this; |
154
|
|
|
} |
155
|
|
|
|
156
|
|
|
/** |
157
|
|
|
* Get profile_image_url_https |
158
|
|
|
* |
159
|
|
|
* @return string |
160
|
|
|
*/ |
161
|
9 |
|
public function getProfileImageUrlHttps() |
162
|
|
|
{ |
163
|
9 |
|
return $this->profile_image_url_https; |
164
|
|
|
} |
165
|
|
|
|
166
|
|
|
/** |
167
|
|
|
* Get profile image, with HTTPS if available |
168
|
|
|
* |
169
|
|
|
* @return string |
170
|
|
|
*/ |
171
|
8 |
|
public function getProfileImageUrlHttpOrHttps() |
172
|
|
|
{ |
173
|
8 |
|
if (! is_null($this->getProfileImageUrlHttps())) { |
174
|
8 |
|
return $this->getProfileImageUrlHttps(); |
175
|
|
|
} |
176
|
|
|
// else |
177
|
|
|
|
178
|
1 |
|
return $this->getProfileImageUrl(); |
179
|
|
|
} |
180
|
|
|
|
181
|
|
|
/** |
182
|
|
|
* Get tweets |
183
|
|
|
* |
184
|
|
|
* @return ArrayCollection |
185
|
|
|
*/ |
186
|
1 |
|
public function getTweets() |
187
|
|
|
{ |
188
|
1 |
|
return $this->tweets; |
189
|
|
|
} |
190
|
|
|
|
191
|
|
|
/** |
192
|
|
|
* Add a tweet |
193
|
|
|
* |
194
|
|
|
* @return User |
195
|
|
|
*/ |
196
|
7 |
|
public function addTweet(Tweet $tweet) |
197
|
|
|
{ |
198
|
7 |
|
$this->tweets->add($tweet); |
199
|
|
|
|
200
|
7 |
|
return $this; |
201
|
|
|
} |
202
|
|
|
|
203
|
|
|
/** |
204
|
|
|
* Call setter functions |
205
|
|
|
* |
206
|
|
|
* @param \stdClass $userTmp |
207
|
|
|
*/ |
208
|
3 |
|
public function setValues(\stdClass $userTmp) |
209
|
|
|
{ |
210
|
3 |
|
$this |
211
|
3 |
|
->setName($userTmp->name) |
212
|
3 |
|
->setScreenName($userTmp->screen_name) |
213
|
3 |
|
->setProfileImageUrlHttps($userTmp->profile_image_url_https) |
214
|
|
|
; |
215
|
|
|
|
216
|
3 |
|
return $this; |
217
|
|
|
} |
218
|
|
|
} |
219
|
|
|
|