1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
|
3
|
|
|
namespace ApiClients\Client\Twitter\Resource; |
4
|
|
|
|
5
|
|
|
use ApiClients\Foundation\Hydrator\Annotations\EmptyResource; |
6
|
|
|
use ApiClients\Foundation\Resource\AbstractResource; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* @EmptyResource("EmptyProfile") |
10
|
|
|
*/ |
11
|
|
|
abstract class Profile extends AbstractResource implements ProfileInterface |
12
|
|
|
{ |
13
|
|
|
/** |
14
|
|
|
* @var int |
15
|
|
|
*/ |
16
|
|
|
protected $id; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* @var string |
20
|
|
|
*/ |
21
|
|
|
protected $id_str; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @var string |
25
|
|
|
*/ |
26
|
|
|
protected $name; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @var string |
30
|
|
|
*/ |
31
|
|
|
protected $screen_name; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @var string |
35
|
|
|
*/ |
36
|
|
|
protected $location; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @var string |
40
|
|
|
*/ |
41
|
|
|
protected $profile_location; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @var string |
45
|
|
|
*/ |
46
|
|
|
protected $description; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @var string |
50
|
|
|
*/ |
51
|
|
|
protected $url; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @var array |
55
|
|
|
*/ |
56
|
|
|
protected $changedFields = []; |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @return int |
60
|
|
|
*/ |
61
|
4 |
|
public function id() : int |
62
|
|
|
{ |
63
|
4 |
|
return $this->id; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @return string |
68
|
|
|
*/ |
69
|
4 |
|
public function idStr() : string |
70
|
|
|
{ |
71
|
4 |
|
return $this->id_str; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* @return string |
76
|
|
|
*/ |
77
|
4 |
|
public function name() : string |
78
|
|
|
{ |
79
|
4 |
|
return $this->name; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* @return string |
84
|
|
|
*/ |
85
|
4 |
|
public function screenName() : string |
86
|
|
|
{ |
87
|
4 |
|
return $this->screen_name; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @return string |
92
|
|
|
*/ |
93
|
4 |
|
public function location() : string |
94
|
|
|
{ |
95
|
4 |
|
return $this->location; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* @return string |
100
|
|
|
*/ |
101
|
4 |
|
public function profileLocation() : string |
102
|
|
|
{ |
103
|
4 |
|
return $this->profile_location; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* @return string |
108
|
|
|
*/ |
109
|
4 |
|
public function description() : string |
110
|
|
|
{ |
111
|
4 |
|
return $this->description; |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* @return string |
116
|
|
|
*/ |
117
|
4 |
|
public function url() : string |
118
|
|
|
{ |
119
|
4 |
|
return $this->url; |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* @param string $name |
124
|
|
|
* @return ProfileInterface |
125
|
|
|
*/ |
126
|
|
View Code Duplication |
public function withName(string $name): ProfileInterface |
|
|
|
|
127
|
|
|
{ |
128
|
|
|
$clone = clone $this; |
129
|
|
|
$clone->name = $name; |
130
|
|
|
$clone->changedFields['name'] = 'name'; |
131
|
|
|
return $clone; |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* @param string $location |
136
|
|
|
* @return ProfileInterface |
137
|
|
|
*/ |
138
|
|
View Code Duplication |
public function withLocation(string $location): ProfileInterface |
|
|
|
|
139
|
|
|
{ |
140
|
|
|
$clone = clone $this; |
141
|
|
|
$clone->location = $location; |
142
|
|
|
$clone->changedFields['location'] = 'location'; |
143
|
|
|
return $clone; |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
/** |
147
|
|
|
* @param string $description |
148
|
|
|
* @return ProfileInterface |
149
|
|
|
*/ |
150
|
|
View Code Duplication |
public function withDescription(string $description): ProfileInterface |
|
|
|
|
151
|
|
|
{ |
152
|
|
|
$clone = clone $this; |
153
|
|
|
$clone->description = $description; |
154
|
|
|
$clone->changedFields['description'] = 'description'; |
155
|
|
|
return $clone; |
156
|
|
|
} |
157
|
|
|
|
158
|
|
|
/** |
159
|
|
|
* @param string $url |
160
|
|
|
* @return ProfileInterface |
161
|
|
|
*/ |
162
|
|
View Code Duplication |
public function withUrl(string $url): ProfileInterface |
|
|
|
|
163
|
|
|
{ |
164
|
|
|
$clone = clone $this; |
165
|
|
|
$clone->url = $url; |
166
|
|
|
$clone->changedFields['url'] = 'url'; |
167
|
|
|
return $clone; |
168
|
|
|
} |
169
|
|
|
|
170
|
|
|
public function putProfile() |
171
|
|
|
{ |
172
|
|
|
} |
173
|
|
|
} |
174
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.