Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
15 / 15 |
CRAP | |
100.00% |
29 / 29 |
| Media | |
100.00% |
1 / 1 |
|
100.00% |
15 / 15 |
16 | |
100.00% |
29 / 29 |
| __construct | |
100.00% |
1 / 1 |
2 | |
100.00% |
4 / 4 |
|||
| setId | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
| getId | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| setMediaUrlHttps | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
| getMediaUrlHttps | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| setUrl | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
| getUrl | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| setDisplayUrl | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
| getDisplayUrl | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| setExpandedUrl | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
| getExpandedUrl | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| addTweet | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
| removeTweet | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
| getTweets | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| setValues | |
100.00% |
1 / 1 |
1 | |
100.00% |
5 / 5 |
|||
| 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 | public function __construct(?int $id = null) |
| 44 | { |
| 45 | if (!is_null($id)) { |
| 46 | $this->setId($id); |
| 47 | } |
| 48 | |
| 49 | $this->tweets = new ArrayCollection(); |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * Set id. |
| 54 | */ |
| 55 | public function setId(int $id): self |
| 56 | { |
| 57 | $this->id = $id; |
| 58 | |
| 59 | return $this; |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * Get id. |
| 64 | */ |
| 65 | public function getId(): int |
| 66 | { |
| 67 | return $this->id; |
| 68 | } |
| 69 | |
| 70 | /** |
| 71 | * Set media_url_https. |
| 72 | */ |
| 73 | public function setMediaUrlHttps(string $mediaUrlHttps): self |
| 74 | { |
| 75 | $this->media_url_https = $mediaUrlHttps; |
| 76 | |
| 77 | return $this; |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * Get media_url_https. |
| 82 | */ |
| 83 | public function getMediaUrlHttps(): string |
| 84 | { |
| 85 | return $this->media_url_https; |
| 86 | } |
| 87 | |
| 88 | /** |
| 89 | * Set url. |
| 90 | */ |
| 91 | public function setUrl(string $url): self |
| 92 | { |
| 93 | $this->url = $url; |
| 94 | |
| 95 | return $this; |
| 96 | } |
| 97 | |
| 98 | /** |
| 99 | * Get url. |
| 100 | */ |
| 101 | public function getUrl(): string |
| 102 | { |
| 103 | return $this->url; |
| 104 | } |
| 105 | |
| 106 | /** |
| 107 | * Set display_url. |
| 108 | */ |
| 109 | public function setDisplayUrl(string $displayUrl): self |
| 110 | { |
| 111 | $this->display_url = $displayUrl; |
| 112 | |
| 113 | return $this; |
| 114 | } |
| 115 | |
| 116 | /** |
| 117 | * Get display_url. |
| 118 | */ |
| 119 | public function getDisplayUrl(): string |
| 120 | { |
| 121 | return $this->display_url; |
| 122 | } |
| 123 | |
| 124 | /** |
| 125 | * Set expanded_url. |
| 126 | */ |
| 127 | public function setExpandedUrl(string $expandedUrl): self |
| 128 | { |
| 129 | $this->expanded_url = $expandedUrl; |
| 130 | |
| 131 | return $this; |
| 132 | } |
| 133 | |
| 134 | /** |
| 135 | * Get expanded_url. |
| 136 | */ |
| 137 | public function getExpandedUrl(): ?string |
| 138 | { |
| 139 | return $this->expanded_url; |
| 140 | } |
| 141 | |
| 142 | /** |
| 143 | * Add a tweet. |
| 144 | */ |
| 145 | public function addTweet(Tweet $tweet): self |
| 146 | { |
| 147 | $this->tweets->add($tweet); |
| 148 | |
| 149 | return $this; |
| 150 | } |
| 151 | |
| 152 | /** |
| 153 | * Remove a tweet. |
| 154 | */ |
| 155 | public function removeTweet(Tweet $tweet): self |
| 156 | { |
| 157 | $this->tweets->removeElement($tweet); |
| 158 | |
| 159 | return $this; |
| 160 | } |
| 161 | |
| 162 | /** |
| 163 | * Get tweets. |
| 164 | * |
| 165 | * @return Collection<int, Tweet> |
| 166 | */ |
| 167 | public function getTweets(): Collection |
| 168 | { |
| 169 | return $this->tweets; |
| 170 | } |
| 171 | |
| 172 | /** |
| 173 | * Call setter functions. |
| 174 | */ |
| 175 | public function setValues(\stdClass $mediaTmp): self |
| 176 | { |
| 177 | $this |
| 178 | ->setMediaUrlHttps($mediaTmp->media_url_https) |
| 179 | ->setUrl($mediaTmp->url) |
| 180 | ->setDisplayUrl($mediaTmp->display_url) |
| 181 | ->setExpandedUrl($mediaTmp->expanded_url); |
| 182 | |
| 183 | return $this; |
| 184 | } |
| 185 | } |