Total Complexity | 56 |
Total Lines | 418 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
Complex classes like ConferenceMeeting 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.
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 ConferenceMeeting, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
20 | #[ORM\Table(name: 'conference_meeting')] |
||
21 | #[ORM\Entity(repositoryClass: ConferenceMeetingRepository::class)] |
||
22 | class ConferenceMeeting |
||
23 | { |
||
24 | use CourseTrait; |
||
25 | use SessionTrait; |
||
26 | use UserTrait; |
||
27 | |||
28 | #[ORM\Id] |
||
29 | #[ORM\GeneratedValue] |
||
30 | #[ORM\Column(type: 'integer')] |
||
31 | protected int $id; |
||
32 | |||
33 | #[ORM\ManyToOne(targetEntity: Course::class)] |
||
34 | #[ORM\JoinColumn(name: 'c_id', referencedColumnName: 'id', onDelete: 'CASCADE')] |
||
35 | protected ?Course $course = null; |
||
36 | |||
37 | #[ORM\ManyToOne(targetEntity: Session::class)] |
||
38 | #[ORM\JoinColumn(name: 'session_id', referencedColumnName: 'id', onDelete: 'CASCADE')] |
||
39 | protected ?Session $session = null; |
||
40 | |||
41 | #[ORM\ManyToOne(targetEntity: AccessUrl::class)] |
||
42 | #[ORM\JoinColumn(name: 'access_url_id', referencedColumnName: 'id', onDelete: 'CASCADE')] |
||
43 | protected ?AccessUrl $accessUrl = null; |
||
44 | |||
45 | #[ORM\ManyToOne(targetEntity: CGroup::class)] |
||
46 | #[ORM\JoinColumn(name: 'group_id', referencedColumnName: 'iid', onDelete: 'CASCADE')] |
||
47 | protected ?CGroup $group = null; |
||
48 | |||
49 | #[ORM\ManyToOne(targetEntity: User::class)] |
||
50 | #[ORM\JoinColumn(name: 'user_id', referencedColumnName: 'id', onDelete: 'CASCADE')] |
||
51 | protected ?User $user = null; |
||
52 | |||
53 | #[ORM\Column(name: 'calendar_id', type: 'integer', nullable: true)] |
||
54 | protected ?int $calendarId = null; |
||
55 | |||
56 | #[ORM\Column(name: 'service_provider', type: 'string', length: 20)] |
||
57 | protected string $serviceProvider = ''; |
||
58 | |||
59 | #[ORM\Column(name: 'remote_id', type: 'string', nullable: true)] |
||
60 | protected ?string $remoteId = null; |
||
61 | |||
62 | #[ORM\Column(name: 'internal_meeting_id', type: 'string', nullable: true)] |
||
63 | protected ?string $internalMeetingId = null; |
||
64 | |||
65 | #[ORM\Column(name: 'title', type: 'string', length: 255)] |
||
66 | protected string $title = ''; |
||
67 | |||
68 | #[ORM\Column(name: 'attendee_pw', type: 'string', nullable: true)] |
||
69 | protected ?string $attendeePw = null; |
||
70 | |||
71 | #[ORM\Column(name: 'moderator_pw', type: 'string', nullable: true)] |
||
72 | protected ?string $moderatorPw = null; |
||
73 | |||
74 | #[ORM\Column(name: 'record', type: 'boolean')] |
||
75 | protected bool $record = false; |
||
76 | |||
77 | #[ORM\Column(name: 'status', type: 'integer')] |
||
78 | protected int $status = 0; |
||
79 | |||
80 | #[ORM\Column(name: 'welcome_msg', type: 'text', nullable: true)] |
||
81 | protected ?string $welcomeMsg = null; |
||
82 | |||
83 | #[ORM\Column(name: 'visibility', type: 'integer')] |
||
84 | protected int $visibility = 0; |
||
85 | |||
86 | #[ORM\Column(name: 'voice_bridge', type: 'integer', nullable: true)] |
||
87 | protected ?int $voiceBridge = null; |
||
88 | |||
89 | #[ORM\Column(name: 'video_url', type: 'string', nullable: true)] |
||
90 | protected ?string $videoUrl = null; |
||
91 | |||
92 | #[ORM\Column(name: 'has_video_m4v', type: 'boolean')] |
||
93 | protected bool $hasVideoM4v = false; |
||
94 | |||
95 | #[ORM\Column(name: 'created_at', type: 'datetime')] |
||
96 | protected DateTime $createdAt; |
||
97 | |||
98 | #[ORM\Column(name: 'closed_at', type: 'datetime', nullable: true)] |
||
99 | protected ?DateTime $closedAt = null; |
||
100 | |||
101 | #[ORM\Column(name: 'meeting_list_item', type: 'text', nullable: true)] |
||
102 | protected ?string $meetingListItem = null; |
||
103 | |||
104 | #[ORM\Column(name: 'meeting_info_get', type: 'text', nullable: true)] |
||
105 | protected ?string $meetingInfoGet = null; |
||
106 | |||
107 | #[ORM\Column(name: 'sign_attendance', type: 'boolean')] |
||
108 | protected bool $signAttendance = false; |
||
109 | |||
110 | #[ORM\Column(name: 'reason_to_sign_attendance', type: 'text', nullable: true)] |
||
111 | protected ?string $reasonToSignAttendance = null; |
||
112 | |||
113 | #[ORM\Column(name: 'account_email', type: 'string', length: 255, nullable: true)] |
||
114 | protected ?string $accountEmail = null; |
||
115 | |||
116 | #[ORM\Column(name: 'webinar_schema', type: 'text', nullable: true)] |
||
117 | protected ?string $webinarSchema = null; |
||
118 | |||
119 | public function __construct() |
||
120 | { |
||
121 | $this->createdAt = new DateTime(); |
||
122 | } |
||
123 | |||
124 | public function getId(): int |
||
125 | { |
||
126 | return $this->id; |
||
127 | } |
||
128 | |||
129 | public function getAccessUrl(): ?AccessUrl |
||
130 | { |
||
131 | return $this->accessUrl; |
||
132 | } |
||
133 | |||
134 | public function setAccessUrl(?AccessUrl $accessUrl): self |
||
135 | { |
||
136 | $this->accessUrl = $accessUrl; |
||
137 | |||
138 | return $this; |
||
139 | } |
||
140 | |||
141 | public function getGroup(): ?CGroup |
||
142 | { |
||
143 | return $this->group; |
||
144 | } |
||
145 | |||
146 | public function setGroup(?CGroup $group): self |
||
147 | { |
||
148 | $this->group = $group; |
||
149 | |||
150 | return $this; |
||
151 | } |
||
152 | |||
153 | public function getCalendarId(): ?int |
||
154 | { |
||
155 | return $this->calendarId; |
||
156 | } |
||
157 | |||
158 | public function setCalendarId(?int $calendarId): self |
||
159 | { |
||
160 | $this->calendarId = $calendarId; |
||
161 | |||
162 | return $this; |
||
163 | } |
||
164 | |||
165 | public function getServiceProvider(): string |
||
166 | { |
||
167 | return $this->serviceProvider; |
||
168 | } |
||
169 | |||
170 | public function setServiceProvider(string $serviceProvider): self |
||
171 | { |
||
172 | $this->serviceProvider = $serviceProvider; |
||
173 | |||
174 | return $this; |
||
175 | } |
||
176 | |||
177 | public function getRemoteId(): ?string |
||
178 | { |
||
179 | return $this->remoteId; |
||
180 | } |
||
181 | |||
182 | public function setRemoteId(?string $remoteId): self |
||
183 | { |
||
184 | $this->remoteId = $remoteId; |
||
185 | |||
186 | return $this; |
||
187 | } |
||
188 | |||
189 | public function getInternalMeetingId(): ?string |
||
190 | { |
||
191 | return $this->internalMeetingId; |
||
192 | } |
||
193 | |||
194 | public function setInternalMeetingId(?string $internalMeetingId): self |
||
195 | { |
||
196 | $this->internalMeetingId = $internalMeetingId; |
||
197 | |||
198 | return $this; |
||
199 | } |
||
200 | |||
201 | public function getTitle(): string |
||
202 | { |
||
203 | return $this->title; |
||
204 | } |
||
205 | |||
206 | public function setTitle(string $title): self |
||
207 | { |
||
208 | $this->title = $title; |
||
209 | |||
210 | return $this; |
||
211 | } |
||
212 | |||
213 | public function getAttendeePw(): ?string |
||
214 | { |
||
215 | return $this->attendeePw; |
||
216 | } |
||
217 | |||
218 | public function setAttendeePw(?string $attendeePw): self |
||
219 | { |
||
220 | $this->attendeePw = $attendeePw; |
||
221 | |||
222 | return $this; |
||
223 | } |
||
224 | |||
225 | public function getModeratorPw(): ?string |
||
226 | { |
||
227 | return $this->moderatorPw; |
||
228 | } |
||
229 | |||
230 | public function setModeratorPw(?string $moderatorPw): self |
||
231 | { |
||
232 | $this->moderatorPw = $moderatorPw; |
||
233 | |||
234 | return $this; |
||
235 | } |
||
236 | |||
237 | public function isRecord(): bool |
||
238 | { |
||
239 | return $this->record; |
||
240 | } |
||
241 | |||
242 | public function setRecord(bool $record): self |
||
243 | { |
||
244 | $this->record = $record; |
||
245 | |||
246 | return $this; |
||
247 | } |
||
248 | |||
249 | public function getStatus(): int |
||
250 | { |
||
251 | return $this->status; |
||
252 | } |
||
253 | |||
254 | public function setStatus(int $status): self |
||
255 | { |
||
256 | $this->status = $status; |
||
257 | |||
258 | return $this; |
||
259 | } |
||
260 | |||
261 | public function getCreatedAt(): DateTime |
||
262 | { |
||
263 | return $this->createdAt; |
||
264 | } |
||
265 | |||
266 | public function getClosedAt(): ?DateTime |
||
267 | { |
||
268 | return $this->closedAt; |
||
269 | } |
||
270 | |||
271 | public function setClosedAt(?DateTime $closedAt): self |
||
272 | { |
||
273 | $this->closedAt = $closedAt; |
||
274 | |||
275 | return $this; |
||
276 | } |
||
277 | |||
278 | public function getWelcomeMsg(): ?string |
||
279 | { |
||
280 | return $this->welcomeMsg; |
||
281 | } |
||
282 | |||
283 | public function setWelcomeMsg(?string $welcomeMsg): self |
||
288 | } |
||
289 | |||
290 | public function getVisibility(): int |
||
291 | { |
||
292 | return $this->visibility; |
||
293 | } |
||
294 | |||
295 | public function setVisibility(int $visibility): self |
||
296 | { |
||
297 | $this->visibility = $visibility; |
||
298 | |||
299 | return $this; |
||
300 | } |
||
301 | |||
302 | public function getVoiceBridge(): ?int |
||
303 | { |
||
304 | return $this->voiceBridge; |
||
305 | } |
||
306 | |||
307 | public function setVoiceBridge(?int $voiceBridge): self |
||
308 | { |
||
309 | $this->voiceBridge = $voiceBridge; |
||
310 | |||
311 | return $this; |
||
312 | } |
||
313 | |||
314 | public function getVideoUrl(): ?string |
||
315 | { |
||
316 | return $this->videoUrl; |
||
317 | } |
||
318 | |||
319 | public function setVideoUrl(?string $videoUrl): self |
||
320 | { |
||
321 | $this->videoUrl = $videoUrl; |
||
322 | |||
323 | return $this; |
||
324 | } |
||
325 | |||
326 | public function isHasVideoM4v(): bool |
||
327 | { |
||
328 | return $this->hasVideoM4v; |
||
329 | } |
||
330 | |||
331 | public function setHasVideoM4v(bool $hasVideoM4v): self |
||
332 | { |
||
333 | $this->hasVideoM4v = $hasVideoM4v; |
||
334 | |||
335 | return $this; |
||
336 | } |
||
337 | |||
338 | public function getMeetingListItem(): ?string |
||
339 | { |
||
340 | return $this->meetingListItem; |
||
341 | } |
||
342 | |||
343 | public function setMeetingListItem(?string $meetingListItem): self |
||
344 | { |
||
345 | $this->meetingListItem = $meetingListItem; |
||
346 | |||
347 | return $this; |
||
348 | } |
||
349 | |||
350 | public function getMeetingInfoGet(): ?string |
||
351 | { |
||
352 | return $this->meetingInfoGet; |
||
353 | } |
||
354 | |||
355 | public function setMeetingInfoGet(?string $meetingInfoGet): self |
||
356 | { |
||
357 | $this->meetingInfoGet = $meetingInfoGet; |
||
358 | |||
359 | return $this; |
||
360 | } |
||
361 | |||
362 | public function isSignAttendance(): bool |
||
363 | { |
||
364 | return $this->signAttendance; |
||
365 | } |
||
366 | |||
367 | public function setSignAttendance(bool $signAttendance): self |
||
368 | { |
||
369 | $this->signAttendance = $signAttendance; |
||
370 | |||
371 | return $this; |
||
372 | } |
||
373 | |||
374 | public function getAccountEmail(): ?string |
||
375 | { |
||
376 | return $this->accountEmail; |
||
377 | } |
||
378 | |||
379 | public function setAccountEmail(?string $accountEmail): self |
||
380 | { |
||
381 | $this->accountEmail = $accountEmail; |
||
382 | |||
383 | return $this; |
||
384 | } |
||
385 | |||
386 | public function getReasonToSignAttendance(): ?string |
||
387 | { |
||
388 | return $this->reasonToSignAttendance; |
||
389 | } |
||
390 | |||
391 | public function setReasonToSignAttendance(?string $reasonToSignAttendance): self |
||
392 | { |
||
393 | $this->reasonToSignAttendance = $reasonToSignAttendance; |
||
394 | |||
395 | return $this; |
||
396 | } |
||
397 | |||
398 | public function getWebinarSchema(): ?string |
||
399 | { |
||
400 | return $this->webinarSchema; |
||
401 | } |
||
402 | |||
403 | public function setWebinarSchema(?string $webinarSchema): self |
||
404 | { |
||
405 | $this->webinarSchema = $webinarSchema; |
||
406 | |||
407 | return $this; |
||
408 | } |
||
409 | |||
410 | public function isVisible(): bool |
||
413 | } |
||
414 | |||
415 | public function isClosed(): bool |
||
416 | { |
||
417 | return $this->status === 0; |
||
418 | } |
||
419 | |||
420 | public function isOpen(): bool |
||
421 | { |
||
422 | return $this->status === 1; |
||
423 | } |
||
424 | |||
425 | public function hasRecording(): bool |
||
426 | { |
||
427 | return $this->record === true; |
||
428 | } |
||
429 | |||
430 | public function hasVideoUrl(): bool |
||
433 | } |
||
434 | |||
435 | public function isRecordingAvailable(): bool |
||
438 | } |
||
439 | } |
||
440 |