1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AlexisLefebvre\Bundle\AsyncTweetsBundle\Entity; |
4
|
|
|
|
5
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
6
|
|
|
use Doctrine\Common\Collections\Collection; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Media. |
10
|
|
|
*/ |
11
|
|
|
class Media |
12
|
|
|
{ |
13
|
|
|
/** |
14
|
|
|
* @var int |
15
|
|
|
*/ |
16
|
|
|
private $id; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* @var string |
20
|
|
|
*/ |
21
|
|
|
private $media_url_https; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @var string |
25
|
|
|
*/ |
26
|
|
|
private $url; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @var string |
30
|
|
|
*/ |
31
|
|
|
private $display_url; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @var string |
35
|
|
|
*/ |
36
|
|
|
private $expanded_url; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @var Collection<int, Tweet> |
40
|
|
|
*/ |
41
|
|
|
private $tweets; |
42
|
|
|
|
43
|
15 |
|
public function __construct(?int $id = null) |
44
|
|
|
{ |
45
|
15 |
|
if (!is_null($id)) { |
46
|
4 |
|
$this->setId($id); |
47
|
|
|
} |
48
|
|
|
|
49
|
15 |
|
$this->tweets = new ArrayCollection(); |
50
|
15 |
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* Set id. |
54
|
|
|
*/ |
55
|
15 |
|
public function setId(int $id): self |
56
|
|
|
{ |
57
|
15 |
|
$this->id = $id; |
58
|
|
|
|
59
|
15 |
|
return $this; |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* Get id. |
64
|
|
|
*/ |
65
|
1 |
|
public function getId(): int |
66
|
|
|
{ |
67
|
1 |
|
return $this->id; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* Set media_url_https. |
72
|
|
|
*/ |
73
|
15 |
|
public function setMediaUrlHttps(string $mediaUrlHttps): self |
74
|
|
|
{ |
75
|
15 |
|
$this->media_url_https = $mediaUrlHttps; |
76
|
|
|
|
77
|
15 |
|
return $this; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* Get media_url_https. |
82
|
|
|
*/ |
83
|
6 |
|
public function getMediaUrlHttps(): string |
84
|
|
|
{ |
85
|
6 |
|
return $this->media_url_https; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* Set url. |
90
|
|
|
*/ |
91
|
15 |
|
public function setUrl(string $url): self |
92
|
|
|
{ |
93
|
15 |
|
$this->url = $url; |
94
|
|
|
|
95
|
15 |
|
return $this; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* Get url. |
100
|
|
|
*/ |
101
|
6 |
|
public function getUrl(): string |
102
|
|
|
{ |
103
|
6 |
|
return $this->url; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* Set display_url. |
108
|
|
|
*/ |
109
|
15 |
|
public function setDisplayUrl(string $displayUrl): self |
110
|
|
|
{ |
111
|
15 |
|
$this->display_url = $displayUrl; |
112
|
|
|
|
113
|
15 |
|
return $this; |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* Get display_url. |
118
|
|
|
*/ |
119
|
6 |
|
public function getDisplayUrl(): string |
120
|
|
|
{ |
121
|
6 |
|
return $this->display_url; |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* Set expanded_url. |
126
|
|
|
*/ |
127
|
15 |
|
public function setExpandedUrl(string $expandedUrl): self |
128
|
|
|
{ |
129
|
15 |
|
$this->expanded_url = $expandedUrl; |
130
|
|
|
|
131
|
15 |
|
return $this; |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* Get expanded_url. |
136
|
|
|
*/ |
137
|
6 |
|
public function getExpandedUrl(): ?string |
138
|
|
|
{ |
139
|
6 |
|
return $this->expanded_url; |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
/** |
143
|
|
|
* Add a tweet. |
144
|
|
|
*/ |
145
|
13 |
|
public function addTweet(Tweet $tweet): self |
146
|
|
|
{ |
147
|
13 |
|
$this->tweets->add($tweet); |
148
|
|
|
|
149
|
13 |
|
return $this; |
150
|
|
|
} |
151
|
|
|
|
152
|
|
|
/** |
153
|
|
|
* Remove a tweet. |
154
|
|
|
*/ |
155
|
1 |
|
public function removeTweet(Tweet $tweet): self |
156
|
|
|
{ |
157
|
1 |
|
$this->tweets->removeElement($tweet); |
158
|
|
|
|
159
|
1 |
|
return $this; |
160
|
|
|
} |
161
|
|
|
|
162
|
|
|
/** |
163
|
|
|
* Get tweets. |
164
|
|
|
* |
165
|
|
|
* @return Collection<int, Tweet> |
|
|
|
|
166
|
|
|
*/ |
167
|
2 |
|
public function getTweets(): Collection |
168
|
|
|
{ |
169
|
2 |
|
return $this->tweets; |
170
|
|
|
} |
171
|
|
|
|
172
|
|
|
/** |
173
|
|
|
* Call setter functions. |
174
|
|
|
*/ |
175
|
3 |
|
public function setValues(\stdClass $mediaTmp): self |
176
|
|
|
{ |
177
|
|
|
$this |
178
|
3 |
|
->setMediaUrlHttps($mediaTmp->media_url_https) |
179
|
3 |
|
->setUrl($mediaTmp->url) |
180
|
3 |
|
->setDisplayUrl($mediaTmp->display_url) |
181
|
3 |
|
->setExpandedUrl($mediaTmp->expanded_url); |
182
|
|
|
|
183
|
3 |
|
return $this; |
184
|
|
|
} |
185
|
|
|
} |
186
|
|
|
|
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.