Complex classes like EventProxy often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use EventProxy, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
16 | class EventProxy extends Proxy implements EventInterface { |
||
17 | |||
18 | /** |
||
19 | * {@inheritdoc} |
||
20 | */ |
||
21 | protected function load() { |
||
29 | |||
30 | /** |
||
31 | * {@inheritdoc} |
||
32 | */ |
||
33 | 1 | public function getAwayFormation() { |
|
34 | 1 | return $this->get('awayFormation'); |
|
35 | } |
||
36 | |||
37 | /** |
||
38 | * {@inheritdoc} |
||
39 | */ |
||
40 | 1 | public function getAwayGoalDetails() { |
|
41 | 1 | return $this->get('awayGoalDetails'); |
|
42 | } |
||
43 | |||
44 | /** |
||
45 | * {@inheritdoc} |
||
46 | */ |
||
47 | 1 | public function getAwayLineupDefense() { |
|
48 | 1 | return $this->get('awayLineupDefense'); |
|
49 | } |
||
50 | |||
51 | /** |
||
52 | * {@inheritdoc} |
||
53 | */ |
||
54 | 1 | public function getAwayLineupForward() { |
|
55 | 1 | return $this->get('awayLineupForward'); |
|
56 | } |
||
57 | |||
58 | /** |
||
59 | * {@inheritdoc} |
||
60 | */ |
||
61 | 1 | public function getAwayLineupGoalkeeper() { |
|
62 | 1 | return $this->get('awayLineupGoalkeeper'); |
|
63 | } |
||
64 | |||
65 | /** |
||
66 | * {@inheritdoc} |
||
67 | */ |
||
68 | 1 | public function getAwayLineupMidfield() { |
|
69 | 1 | return $this->get('awayLineupMidfield'); |
|
70 | } |
||
71 | |||
72 | /** |
||
73 | * {@inheritdoc} |
||
74 | */ |
||
75 | 1 | public function getAwayLineupSubstitutes() { |
|
76 | 1 | return $this->get('awayLineupSubstitutes'); |
|
77 | } |
||
78 | |||
79 | /** |
||
80 | * {@inheritdoc} |
||
81 | */ |
||
82 | 1 | public function getAwayRedCards() { |
|
83 | 1 | return $this->get('awayRedCards'); |
|
84 | } |
||
85 | |||
86 | /** |
||
87 | * {@inheritdoc} |
||
88 | */ |
||
89 | 1 | public function getAwayScore() { |
|
90 | 1 | return $this->get('awayScore'); |
|
91 | } |
||
92 | |||
93 | /** |
||
94 | * {@inheritdoc} |
||
95 | */ |
||
96 | 1 | public function getAwayShots() { |
|
97 | 1 | return $this->get('awayShots'); |
|
98 | } |
||
99 | |||
100 | /** |
||
101 | * {@inheritdoc} |
||
102 | */ |
||
103 | 1 | public function getAwayTeam() { |
|
104 | 1 | return $this->get('awayTeam'); |
|
105 | } |
||
106 | |||
107 | /** |
||
108 | * {@inheritdoc} |
||
109 | */ |
||
110 | 1 | public function getAwayYellowCards() { |
|
111 | 1 | return $this->get('awayYellowCards'); |
|
112 | } |
||
113 | |||
114 | /** |
||
115 | * {@inheritdoc} |
||
116 | */ |
||
117 | 1 | public function getBanner() { |
|
118 | 1 | return $this->get('banner'); |
|
119 | } |
||
120 | |||
121 | /** |
||
122 | * {@inheritdoc} |
||
123 | */ |
||
124 | 1 | public function getCircuit() { |
|
125 | 1 | return $this->get('circuit'); |
|
126 | } |
||
127 | |||
128 | /** |
||
129 | * {@inheritdoc} |
||
130 | */ |
||
131 | 1 | public function getCity() { |
|
132 | 1 | return $this->get('city'); |
|
133 | } |
||
134 | |||
135 | /** |
||
136 | * {@inheritdoc} |
||
137 | */ |
||
138 | 1 | public function getCountry() { |
|
139 | 1 | return $this->get('country'); |
|
140 | } |
||
141 | |||
142 | /** |
||
143 | * {@inheritdoc} |
||
144 | */ |
||
145 | 1 | public function getDate() { |
|
146 | 1 | return $this->get('date'); |
|
147 | } |
||
148 | |||
149 | /** |
||
150 | * {@inheritdoc} |
||
151 | */ |
||
152 | 1 | public function getDescription() { |
|
153 | 1 | return $this->get('description'); |
|
154 | } |
||
155 | |||
156 | /** |
||
157 | * {@inheritdoc} |
||
158 | */ |
||
159 | 1 | public function getFilename() { |
|
160 | 1 | return $this->get('filename'); |
|
161 | } |
||
162 | |||
163 | /** |
||
164 | * {@inheritdoc} |
||
165 | */ |
||
166 | 1 | public function getHomeFormation() { |
|
167 | 1 | return $this->get('homeFormation'); |
|
168 | } |
||
169 | |||
170 | /** |
||
171 | * {@inheritdoc} |
||
172 | */ |
||
173 | 1 | public function getHomeGoalDetails() { |
|
174 | 1 | return $this->get('homeGoalDetails'); |
|
175 | } |
||
176 | |||
177 | /** |
||
178 | * {@inheritdoc} |
||
179 | */ |
||
180 | 1 | public function getHomeLineupDefense() { |
|
181 | 1 | return $this->get('homeLineupDefense'); |
|
182 | } |
||
183 | |||
184 | /** |
||
185 | * {@inheritdoc} |
||
186 | */ |
||
187 | 1 | public function getHomeLineupForward() { |
|
188 | 1 | return $this->get('homeLineupForward'); |
|
189 | } |
||
190 | |||
191 | /** |
||
192 | * {@inheritdoc} |
||
193 | */ |
||
194 | 1 | public function getHomeLineupGoalkeeper() { |
|
195 | 1 | return $this->get('homeLineupGoalkeeper'); |
|
196 | } |
||
197 | |||
198 | /** |
||
199 | * {@inheritdoc} |
||
200 | */ |
||
201 | 1 | public function getHomeLineupMidfield() { |
|
202 | 1 | return $this->get('homeLineupMidfield'); |
|
203 | } |
||
204 | |||
205 | /** |
||
206 | * {@inheritdoc} |
||
207 | */ |
||
208 | 1 | public function getHomeLineupSubstitutes() { |
|
209 | 1 | return $this->get('homeLineupSubstitutes'); |
|
210 | } |
||
211 | |||
212 | /** |
||
213 | * {@inheritdoc} |
||
214 | */ |
||
215 | 1 | public function getHomeRedCards() { |
|
216 | 1 | return $this->get('homeRedCards'); |
|
217 | } |
||
218 | |||
219 | /** |
||
220 | * {@inheritdoc} |
||
221 | */ |
||
222 | 1 | public function getHomeScore() { |
|
223 | 1 | return $this->get('homeScore'); |
|
224 | } |
||
225 | |||
226 | /** |
||
227 | * {@inheritdoc} |
||
228 | */ |
||
229 | 1 | public function getHomeShots() { |
|
230 | 1 | return $this->get('homeShots'); |
|
231 | } |
||
232 | |||
233 | /** |
||
234 | * {@inheritdoc} |
||
235 | */ |
||
236 | 1 | public function getHomeTeam() { |
|
237 | 1 | return $this->get('homeTeam'); |
|
238 | } |
||
239 | |||
240 | /** |
||
241 | * {@inheritdoc} |
||
242 | */ |
||
243 | 1 | public function getHomeYellowCards() { |
|
244 | 1 | return $this->get('homeYellowCards'); |
|
245 | } |
||
246 | |||
247 | /** |
||
248 | * {@inheritdoc} |
||
249 | */ |
||
250 | 1 | public function getId() { |
|
251 | 1 | return $this->get('id'); |
|
252 | } |
||
253 | |||
254 | /** |
||
255 | * {@inheritdoc} |
||
256 | */ |
||
257 | 1 | public function getLeague() { |
|
258 | 1 | return $this->get('league'); |
|
259 | } |
||
260 | |||
261 | /** |
||
262 | * {@inheritdoc} |
||
263 | */ |
||
264 | 1 | public function getLocked() { |
|
265 | 1 | return $this->get('locked'); |
|
266 | } |
||
267 | |||
268 | /** |
||
269 | * {@inheritdoc} |
||
270 | */ |
||
271 | 1 | public function getMap() { |
|
272 | 1 | return $this->get('map'); |
|
273 | } |
||
274 | |||
275 | /** |
||
276 | * {@inheritdoc} |
||
277 | */ |
||
278 | 1 | public function getName() { |
|
279 | 1 | return $this->get('name'); |
|
280 | } |
||
281 | |||
282 | /** |
||
283 | * {@inheritdoc} |
||
284 | */ |
||
285 | 1 | public function getPoster() { |
|
286 | 1 | return $this->get('poster'); |
|
287 | } |
||
288 | |||
289 | /** |
||
290 | * {@inheritdoc} |
||
291 | */ |
||
292 | 1 | public function getResult() { |
|
293 | 1 | return $this->get('result'); |
|
294 | } |
||
295 | |||
296 | /** |
||
297 | * {@inheritdoc} |
||
298 | */ |
||
299 | 1 | public function getRound() { |
|
300 | 1 | return $this->get('round'); |
|
301 | } |
||
302 | |||
303 | /** |
||
304 | * {@inheritdoc} |
||
305 | */ |
||
306 | 1 | public function getSeason() { |
|
307 | 1 | return $this->get('season'); |
|
308 | } |
||
309 | |||
310 | /** |
||
311 | * {@inheritdoc} |
||
312 | */ |
||
313 | 1 | public function getSpecators() { |
|
314 | 1 | return $this->get('specators'); |
|
315 | } |
||
316 | |||
317 | /** |
||
318 | * {@inheritdoc} |
||
319 | */ |
||
320 | 1 | public function getThumb() { |
|
321 | 1 | return $this->get('thumb'); |
|
322 | } |
||
323 | |||
324 | /** |
||
325 | * {@inheritdoc} |
||
326 | */ |
||
327 | public function getTime() { |
||
330 | |||
331 | /** |
||
332 | * {@inheritdoc} |
||
333 | */ |
||
334 | 1 | public function getTvStation() { |
|
335 | 1 | return $this->get('tvStation'); |
|
336 | } |
||
337 | } |
||
338 |