Test Failed
Push — master ( c2c60e...83ec37 )
by Alexis
14:02 queued 09:54
created

Media::removeTweet()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 0
cts 3
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
namespace AlexisLefebvre\Bundle\AsyncTweetsBundle\Entity;
4
5
use Doctrine\Common\Collections\ArrayCollection;
6
7
/**
8
 * Media.
9
 */
10
class Media
11
{
12
    /**
13
     * @var int
14
     */
15
    private $id;
16
17
    /**
18
     * @var string
19
     */
20
    private $media_url_https;
21
22
    /**
23
     * @var string
24
     */
25
    private $url;
26
27
    /**
28
     * @var string
29
     */
30
    private $display_url;
31
32
    /**
33
     * @var string
34
     */
35
    private $expanded_url;
36
37
    /**
38
     * @var ArrayCollection
39
     */
40
    private $tweets;
41
42 15
    public function __construct($id = null)
43
    {
44 15
        if (!is_null($id)) {
45 4
            $this->setId($id);
46
        }
47
48 15
        $this->tweets = new ArrayCollection();
49 15
    }
50
51
    /**
52
     * Set id.
53
     *
54
     * @param int $id
55
     *
56
     * @return Media
57
     */
58 15
    public function setId($id)
59
    {
60 15
        $this->id = $id;
61
62 15
        return $this;
63
    }
64
65
    /**
66
     * Get id.
67
     *
68
     * @return int
69
     */
70 1
    public function getId()
71
    {
72 1
        return $this->id;
73
    }
74
75
    /**
76
     * Set media_url_https.
77
     *
78
     * @param string $mediaUrlHttps
79
     *
80
     * @return Media
81
     */
82 15
    public function setMediaUrlHttps($mediaUrlHttps)
83
    {
84 15
        $this->media_url_https = $mediaUrlHttps;
85
86 15
        return $this;
87
    }
88
89
    /**
90
     * Get media_url_https.
91
     *
92
     * @return string
93
     */
94 4
    public function getMediaUrlHttps()
95
    {
96 4
        return $this->media_url_https;
97
    }
98
99
    /**
100
     * Set url.
101
     *
102
     * @param string $url
103
     *
104
     * @return Media
105
     */
106 15
    public function setUrl($url)
107
    {
108 15
        $this->url = $url;
109
110 15
        return $this;
111
    }
112
113
    /**
114
     * Get url.
115
     *
116
     * @return string
117
     */
118 4
    public function getUrl()
119
    {
120 4
        return $this->url;
121
    }
122
123
    /**
124
     * Set display_url.
125
     *
126
     * @param string $displayUrl
127
     *
128
     * @return Media
129
     */
130 15
    public function setDisplayUrl($displayUrl)
131
    {
132 15
        $this->display_url = $displayUrl;
133
134 15
        return $this;
135
    }
136
137
    /**
138
     * Get display_url.
139
     *
140
     * @return string
141
     */
142 4
    public function getDisplayUrl()
143
    {
144 4
        return $this->display_url;
145
    }
146
147
    /**
148
     * Set expanded_url.
149
     *
150
     * @param string $expandedUrl
151
     *
152
     * @return Media
153
     */
154 15
    public function setExpandedUrl($expandedUrl)
155
    {
156 15
        $this->expanded_url = $expandedUrl;
157
158 15
        return $this;
159
    }
160
161
    /**
162
     * Get expanded_url.
163
     *
164
     * @return string
165
     */
166 4
    public function getExpandedUrl()
167
    {
168 4
        return $this->expanded_url;
169
    }
170
171
    /**
172
     * Add a tweet.
173
     *
174
     * @param Tweet $tweet
175
     *
176
     * @return Media
177
     */
178 13
    public function addTweet(Tweet $tweet)
179
    {
180 13
        $this->tweets->add($tweet);
181
182 13
        return $this;
183
    }
184
185
    /**
186
     * Remove a tweet.
187
     *
188
     * @param Tweet $tweet
189
     *
190
     * @return Media
191
     */
192
    public function removeTweet(Tweet $tweet)
193
    {
194
        $this->tweets->removeElement($tweet);
195
196
        return $this;
197
    }
198
199
    /**
200
     * Get tweets.
201
     *
202
     * @return ArrayCollection
203
     */
204 1
    public function getTweets()
205
    {
206 1
        return $this->tweets;
207
    }
208
209
    /**
210
     * Call setter functions.
211
     *
212
     * @param \stdClass $mediaTmp
213
     *
214
     * @return Media
215
     */
216 3
    public function setValues(\stdClass $mediaTmp)
217
    {
218
        $this
219 3
            ->setMediaUrlHttps($mediaTmp->media_url_https)
220 3
            ->setUrl($mediaTmp->url)
221 3
            ->setDisplayUrl($mediaTmp->display_url)
222 3
            ->setExpandedUrl($mediaTmp->expanded_url);
223
224 3
        return $this;
225
    }
226
}
227