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