Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
15 / 15
CRAP
100.00% covered (success)
100.00%
29 / 29
User
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
15 / 15
17
100.00% covered (success)
100.00%
29 / 29
 __construct
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
4 / 4
 setId
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 getId
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 setName
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 getName
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 setScreenName
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 getScreenName
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 setProfileImageUrl
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 getProfileImageUrl
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 setProfileImageUrlHttps
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 getProfileImageUrlHttps
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 getProfileImageUrlHttpOrHttps
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
3 / 3
 getTweets
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 addTweet
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 setValues
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
4 / 4
1<?php
2
3namespace AlexisLefebvre\Bundle\AsyncTweetsBundle\Entity;
4
5use Doctrine\Common\Collections\ArrayCollection;
6use Doctrine\Common\Collections\Collection;
7
8/**
9 * User.
10 */
11class User
12{
13    /**
14     * @var int
15     */
16    private $id;
17
18    /**
19     * @var string
20     */
21    private $name;
22
23    /**
24     * @var string
25     */
26    private $screen_name;
27
28    /**
29     * @var string|null
30     */
31    private $profile_image_url;
32
33    /**
34     * @var string|null
35     */
36    private $profile_image_url_https;
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    public function setId(int $id): self
53    {
54        $this->id = $id;
55
56        return $this;
57    }
58
59    public function getId(): int
60    {
61        return $this->id;
62    }
63
64    /**
65     * Set name.
66     */
67    public function setName(string $name): self
68    {
69        $this->name = $name;
70
71        return $this;
72    }
73
74    /**
75     * Get name.
76     */
77    public function getName(): string
78    {
79        return $this->name;
80    }
81
82    /**
83     * Set screen_name.
84     */
85    public function setScreenName(string $screenName): self
86    {
87        $this->screen_name = $screenName;
88
89        return $this;
90    }
91
92    /**
93     * Get screen_name.
94     */
95    public function getScreenName(): string
96    {
97        return $this->screen_name;
98    }
99
100    /**
101     * Set profile_image_url.
102     */
103    public function setProfileImageUrl(?string $profileImageUrl): self
104    {
105        $this->profile_image_url = $profileImageUrl;
106
107        return $this;
108    }
109
110    /**
111     * Get profile_image_url.
112     */
113    public function getProfileImageUrl(): ?string
114    {
115        return $this->profile_image_url;
116    }
117
118    /**
119     * Set profile_image_url_https.
120     */
121    public function setProfileImageUrlHttps(?string $profileImageUrlHttps): self
122    {
123        $this->profile_image_url_https = $profileImageUrlHttps;
124
125        return $this;
126    }
127
128    /**
129     * Get profile_image_url_https.
130     */
131    public function getProfileImageUrlHttps(): ?string
132    {
133        return $this->profile_image_url_https;
134    }
135
136    /**
137     * Get profile image, with HTTPS if available.
138     */
139    public function getProfileImageUrlHttpOrHttps(): ?string
140    {
141        if (!is_null($this->getProfileImageUrlHttps())) {
142            return $this->getProfileImageUrlHttps();
143        }
144        // else
145
146        return $this->getProfileImageUrl();
147    }
148
149    /**
150     * Get tweets.
151     *
152     * @return Collection<int, Tweet>
153     */
154    public function getTweets(): Collection
155    {
156        return $this->tweets;
157    }
158
159    /**
160     * Add a tweet.
161     */
162    public function addTweet(Tweet $tweet): self
163    {
164        $this->tweets->add($tweet);
165
166        return $this;
167    }
168
169    /**
170     * Call setter functions.
171     */
172    public function setValues(\stdClass $userTmp): self
173    {
174        $this
175            ->setName($userTmp->name)
176            ->setScreenName($userTmp->screen_name)
177            ->setProfileImageUrlHttps($userTmp->profile_image_url_https);
178
179        return $this;
180    }
181}