Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like CdbXMLImporter 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 CdbXMLImporter, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
23 | class CdbXMLImporter |
||
24 | { |
||
25 | /** |
||
26 | * @var CdbXMLItemBaseImporter |
||
27 | */ |
||
28 | private $cdbXMLItemBaseImporter; |
||
29 | |||
30 | /** |
||
31 | * @var EventCdbIdExtractorInterface |
||
32 | */ |
||
33 | private $cdbIdExtractor; |
||
34 | |||
35 | /** |
||
36 | * @var PriceDescriptionParser |
||
37 | */ |
||
38 | private $priceDescriptionParser; |
||
39 | |||
40 | /** |
||
41 | * @var StringFilterInterface |
||
42 | */ |
||
43 | private $longDescriptionFilter; |
||
44 | |||
45 | /** |
||
46 | * @var StringFilterInterface |
||
47 | */ |
||
48 | private $shortDescriptionFilter; |
||
49 | |||
50 | /** |
||
51 | * @var CalendarFactoryInterface |
||
52 | */ |
||
53 | private $calendarFactory; |
||
54 | |||
55 | /** |
||
56 | * @param CdbXMLItemBaseImporter $dbXMLItemBaseImporter |
||
57 | * @param EventCdbIdExtractorInterface $cdbIdExtractor |
||
58 | * @param PriceDescriptionParser $priceDescriptionParser |
||
59 | * @param CalendarFactoryInterface $calendarFactory |
||
60 | */ |
||
61 | public function __construct( |
||
62 | CdbXMLItemBaseImporter $dbXMLItemBaseImporter, |
||
63 | EventCdbIdExtractorInterface $cdbIdExtractor, |
||
64 | PriceDescriptionParser $priceDescriptionParser, |
||
65 | CalendarFactoryInterface $calendarFactory |
||
66 | ) { |
||
67 | $this->cdbXMLItemBaseImporter = $dbXMLItemBaseImporter; |
||
68 | $this->cdbIdExtractor = $cdbIdExtractor; |
||
69 | $this->priceDescriptionParser = $priceDescriptionParser; |
||
70 | $this->calendarFactory = $calendarFactory; |
||
71 | |||
72 | $consecutiveBlockOfTextFilter = new ConsecutiveBlockOfTextStringFilter(); |
||
73 | |||
74 | $this->longDescriptionFilter = new CombinedStringFilter(); |
||
75 | $this->longDescriptionFilter->addFilter( |
||
76 | new StripSourceStringFilter() |
||
77 | ); |
||
78 | $this->longDescriptionFilter->addFilter( |
||
79 | $consecutiveBlockOfTextFilter |
||
80 | ); |
||
81 | $this->longDescriptionFilter->addFilter( |
||
82 | new BreakTagToNewlineStringFilter() |
||
83 | ); |
||
84 | $this->longDescriptionFilter->addFilter( |
||
85 | new StripSurroundingSpaceStringFilter() |
||
86 | ); |
||
87 | |||
88 | $this->shortDescriptionFilter = $consecutiveBlockOfTextFilter; |
||
89 | } |
||
90 | |||
91 | /** |
||
92 | * Imports a UDB2 event into a UDB3 JSON-LD document. |
||
93 | * |
||
94 | * @param \stdClass $base |
||
95 | * The JSON-LD document to start from. |
||
96 | * @param \CultureFeed_Cdb_Item_Event $event |
||
97 | * The cultural event data from UDB2 to import. |
||
98 | * @param PlaceServiceInterface $placeManager |
||
99 | * The manager from which to retrieve the JSON-LD of a place. |
||
100 | * @param OrganizerServiceInterface $organizerManager |
||
101 | * The manager from which to retrieve the JSON-LD of an organizer. |
||
102 | * @param SluggerInterface $slugger |
||
103 | * The slugger that's used to generate a sameAs reference. |
||
104 | * |
||
105 | * @return \stdClass |
||
106 | * The document with the UDB2 event data merged in. |
||
107 | */ |
||
108 | public function documentWithCdbXML( |
||
109 | $base, |
||
110 | \CultureFeed_Cdb_Item_Event $event, |
||
111 | PlaceServiceInterface $placeManager, |
||
112 | OrganizerServiceInterface $organizerManager, |
||
113 | SluggerInterface $slugger |
||
114 | ) { |
||
115 | $jsonLD = clone $base; |
||
116 | |||
117 | /** @var \CultureFeed_Cdb_Data_EventDetail $detail */ |
||
118 | $detail = null; |
||
119 | |||
120 | /** @var \CultureFeed_Cdb_Data_EventDetail[] $details */ |
||
121 | $details = $event->getDetails(); |
||
122 | |||
123 | foreach ($details as $languageDetail) { |
||
124 | $language = $languageDetail->getLanguage(); |
||
125 | |||
126 | // The first language detail found will be used to retrieve |
||
127 | // properties from which in UDB3 are not any longer considered |
||
128 | // to be language specific. |
||
129 | if (!$detail) { |
||
130 | $detail = $languageDetail; |
||
131 | } |
||
132 | |||
133 | $jsonLD->name[$language] = $languageDetail->getTitle(); |
||
134 | |||
135 | $this->importDescription($languageDetail, $jsonLD, $language); |
||
136 | } |
||
137 | |||
138 | $this->cdbXMLItemBaseImporter->importAvailable($event, $jsonLD); |
||
139 | |||
140 | $this->importPicture($detail, $jsonLD); |
||
141 | |||
142 | $labelImporter = new LabelImporter(); |
||
143 | $labelImporter->importLabels($event, $jsonLD); |
||
144 | |||
145 | $jsonLD->calendarSummary = $detail->getCalendarSummary(); |
||
146 | |||
147 | $this->importLocation($event, $placeManager, $jsonLD); |
||
148 | |||
149 | $this->importOrganizer($event, $organizerManager, $jsonLD); |
||
150 | |||
151 | $this->importBookingInfo($event, $detail, $jsonLD); |
||
152 | |||
153 | $this->importPriceInfo($detail, $jsonLD); |
||
154 | |||
155 | $this->importTerms($event, $jsonLD); |
||
156 | |||
157 | $this->cdbXMLItemBaseImporter->importPublicationInfo($event, $jsonLD); |
||
158 | |||
159 | $calendar = $this->calendarFactory->createFromCdbCalendar($event->getCalendar()); |
||
160 | $jsonLD = (object)array_merge((array)$jsonLD, $calendar->toJsonLd()); |
||
161 | |||
162 | $this->importTypicalAgeRange($event, $jsonLD); |
||
163 | |||
164 | $this->importPerformers($detail, $jsonLD); |
||
165 | |||
166 | $this->importLanguages($event, $jsonLD); |
||
167 | |||
168 | $this->importUitInVlaanderenReference($event, $slugger, $jsonLD); |
||
169 | |||
170 | $this->cdbXMLItemBaseImporter->importExternalId($event, $jsonLD); |
||
171 | |||
172 | $this->importSeeAlso($event, $jsonLD); |
||
173 | |||
174 | $this->importContactPoint($event, $jsonLD); |
||
175 | |||
176 | $this->cdbXMLItemBaseImporter->importWorkflowStatus($event, $jsonLD); |
||
177 | |||
178 | return $jsonLD; |
||
179 | } |
||
180 | |||
181 | /** |
||
182 | * @param int $unixTime |
||
183 | * @return \DateTime |
||
184 | */ |
||
185 | private function dateFromUdb2UnixTime($unixTime) |
||
186 | { |
||
187 | $dateTime = new \DateTime( |
||
188 | '@' . $unixTime, |
||
189 | new \DateTimeZone('Europe/Brussels') |
||
190 | ); |
||
191 | |||
192 | return $dateTime; |
||
193 | } |
||
194 | |||
195 | /** |
||
196 | * @param \CultureFeed_Cdb_Data_EventDetail $languageDetail |
||
197 | * @param \stdClass $jsonLD |
||
198 | * @param string $language |
||
199 | */ |
||
200 | private function importDescription($languageDetail, $jsonLD, $language) |
||
201 | { |
||
202 | $longDescription = $languageDetail->getLongDescription(); |
||
203 | |||
204 | if ($longDescription) { |
||
205 | $longDescription = $this->longDescriptionFilter->filter( |
||
206 | $longDescription |
||
207 | ); |
||
208 | } |
||
209 | |||
210 | $descriptions = []; |
||
211 | |||
212 | $shortDescription = $languageDetail->getShortDescription(); |
||
213 | if ($shortDescription) { |
||
214 | $shortDescription = $this->shortDescriptionFilter->filter( |
||
215 | $shortDescription |
||
216 | ); |
||
217 | |||
218 | if ($longDescription) { |
||
219 | $includeShortDescription = |
||
220 | !$this->longDescriptionStartsWithShortDescription( |
||
221 | $longDescription, |
||
222 | $shortDescription |
||
223 | ); |
||
224 | |||
225 | if ($includeShortDescription) { |
||
226 | $descriptions[] = $shortDescription; |
||
227 | } |
||
228 | } |
||
229 | } |
||
230 | |||
231 | if ($longDescription) { |
||
232 | $descriptions[] = $longDescription; |
||
233 | } |
||
234 | |||
235 | $description = implode("\n\n", $descriptions); |
||
236 | |||
237 | $jsonLD->description[$language] = $description; |
||
238 | } |
||
239 | |||
240 | /** |
||
241 | * @param \CultureFeed_Cdb_Data_EventDetail $detail |
||
242 | * @param \stdClass $jsonLD |
||
243 | * |
||
244 | * This is based on code found in the culturefeed theme. |
||
245 | * @see https://github.com/cultuurnet/culturefeed/blob/master/culturefeed_agenda/theme/theme.inc#L266-L284 |
||
246 | */ |
||
247 | View Code Duplication | private function importPicture($detail, $jsonLD) |
|
|
|||
248 | { |
||
249 | $mainPicture = null; |
||
250 | |||
251 | // first check if there is a media file that is main and has the PHOTO media type |
||
252 | $photos = $detail->getMedia()->byMediaType(CultureFeed_Cdb_Data_File::MEDIA_TYPE_PHOTO); |
||
253 | foreach ($photos as $photo) { |
||
254 | if ($photo->isMain()) { |
||
255 | $mainPicture = $photo; |
||
256 | } |
||
257 | } |
||
258 | |||
259 | // the IMAGEWEB media type is deprecated but can still be used as a main image if there is no PHOTO |
||
260 | if (empty($mainPicture)) { |
||
261 | $images = $detail->getMedia()->byMediaType(CultureFeed_Cdb_Data_File::MEDIA_TYPE_IMAGEWEB); |
||
262 | foreach ($images as $image) { |
||
263 | if ($image->isMain()) { |
||
264 | $mainPicture = $image; |
||
265 | } |
||
266 | } |
||
267 | } |
||
268 | |||
269 | // if there is no explicit main image we just use the oldest picture of any type |
||
270 | if (empty($mainPicture)) { |
||
271 | $pictures = $detail->getMedia()->byMediaTypes( |
||
272 | [ |
||
273 | CultureFeed_Cdb_Data_File::MEDIA_TYPE_PHOTO, |
||
274 | CultureFeed_Cdb_Data_File::MEDIA_TYPE_IMAGEWEB |
||
275 | ] |
||
276 | ); |
||
277 | |||
278 | $pictures->rewind(); |
||
279 | $mainPicture = count($pictures) > 0 ? $pictures->current() : null; |
||
280 | } |
||
281 | |||
282 | if ($mainPicture) { |
||
283 | $jsonLD->image = $mainPicture->getHLink(); |
||
284 | } |
||
285 | } |
||
286 | |||
287 | /** |
||
288 | * @param \CultureFeed_Cdb_Item_Event $event |
||
289 | * @param PlaceServiceInterface $placeManager |
||
290 | * @param \stdClass $jsonLD |
||
291 | */ |
||
292 | private function importLocation(\CultureFeed_Cdb_Item_Event $event, PlaceServiceInterface $placeManager, $jsonLD) |
||
293 | { |
||
294 | $location = array(); |
||
295 | $location['@type'] = 'Place'; |
||
296 | |||
297 | $location_id = $this->cdbIdExtractor->getRelatedPlaceCdbId($event); |
||
298 | |||
299 | if ($location_id) { |
||
300 | $location += (array)$placeManager->placeJSONLD($location_id); |
||
301 | } else { |
||
302 | $location_cdb = $event->getLocation(); |
||
303 | $location['name']['nl'] = $location_cdb->getLabel(); |
||
304 | $address = $location_cdb->getAddress()->getPhysicalAddress(); |
||
305 | if ($address) { |
||
306 | $location['address'] = array( |
||
307 | 'addressCountry' => $address->getCountry(), |
||
308 | 'addressLocality' => $address->getCity(), |
||
309 | 'postalCode' => $address->getZip(), |
||
310 | 'streetAddress' => |
||
311 | $address->getStreet() . ' ' . $address->getHouseNumber( |
||
312 | ), |
||
313 | ); |
||
314 | } |
||
315 | } |
||
316 | $jsonLD->location = $location; |
||
317 | } |
||
318 | |||
319 | /** |
||
320 | * @param \CultureFeed_Cdb_Item_Event $event |
||
321 | * @param OrganizerServiceInterface $organizerManager |
||
322 | * @param \stdClass $jsonLD |
||
323 | */ |
||
324 | private function importOrganizer( |
||
325 | \CultureFeed_Cdb_Item_Event $event, |
||
326 | OrganizerServiceInterface $organizerManager, |
||
327 | $jsonLD |
||
328 | ) { |
||
329 | $organizer = null; |
||
330 | $organizer_id = $this->cdbIdExtractor->getRelatedOrganizerCdbId($event); |
||
331 | $organizer_cdb = $event->getOrganiser(); |
||
332 | $contact_info_cdb = $event->getContactInfo(); |
||
333 | |||
334 | if ($organizer_id) { |
||
335 | $organizer = (array)$organizerManager->organizerJSONLD($organizer_id); |
||
336 | } elseif ($organizer_cdb && $contact_info_cdb) { |
||
337 | $organizer = array(); |
||
338 | $organizer['name'] = $organizer_cdb->getLabel(); |
||
339 | |||
340 | $emails_cdb = $contact_info_cdb->getMails(); |
||
341 | if (count($emails_cdb) > 0) { |
||
342 | $organizer['email'] = array(); |
||
343 | foreach ($emails_cdb as $email) { |
||
344 | $organizer['email'][] = $email->getMailAddress(); |
||
345 | } |
||
346 | } |
||
347 | |||
348 | /** @var \CultureFeed_Cdb_Data_Phone[] $phones_cdb */ |
||
349 | $phones_cdb = $contact_info_cdb->getPhones(); |
||
350 | if (count($phones_cdb) > 0) { |
||
351 | $organizer['phone'] = array(); |
||
352 | foreach ($phones_cdb as $phone) { |
||
353 | $organizer['phone'][] = $phone->getNumber(); |
||
354 | } |
||
355 | } |
||
356 | } |
||
357 | |||
358 | if (!is_null($organizer)) { |
||
359 | $organizer['@type'] = 'Organizer'; |
||
360 | $jsonLD->organizer = $organizer; |
||
361 | } |
||
362 | } |
||
363 | |||
364 | /** |
||
365 | * @param \CultureFeed_Cdb_Data_EventDetail $detail |
||
366 | * @param \stdClass $jsonLD |
||
367 | */ |
||
368 | private function importPriceInfo( |
||
369 | \CultureFeed_Cdb_Data_EventDetail $detail, |
||
370 | $jsonLD |
||
371 | ) { |
||
372 | $prices = array(); |
||
373 | |||
374 | $price = $detail->getPrice(); |
||
375 | |||
376 | if ($price) { |
||
377 | $description = $price->getDescription(); |
||
378 | |||
379 | if ($description) { |
||
380 | $prices = $this->priceDescriptionParser->parse($description); |
||
381 | } |
||
382 | |||
383 | // If price description was not interpretable, fall back to |
||
384 | // price title and value. |
||
385 | if (empty($prices) && $price->getValue() !== null) { |
||
386 | $prices['Basistarief'] = floatval($price->getValue()); |
||
387 | } |
||
388 | } |
||
389 | |||
390 | if (!empty($prices)) { |
||
391 | $priceInfo = array(); |
||
392 | |||
393 | /** @var \CultureFeed_Cdb_Data_Price $price */ |
||
394 | foreach ($prices as $title => $value) { |
||
395 | $priceInfoItem = array( |
||
396 | 'name' => $title, |
||
397 | 'priceCurrency' => 'EUR', |
||
398 | 'price' => $value, |
||
399 | ); |
||
400 | |||
401 | $priceInfoItem['category'] = 'tariff'; |
||
402 | |||
403 | if ($priceInfoItem['name'] === 'Basistarief') { |
||
404 | $priceInfoItem['category'] = 'base'; |
||
405 | } |
||
406 | |||
407 | $priceInfo[] = $priceInfoItem; |
||
408 | } |
||
409 | |||
410 | if (!empty($priceInfo)) { |
||
411 | $jsonLD->priceInfo = $priceInfo; |
||
412 | } |
||
413 | } |
||
414 | } |
||
415 | |||
416 | /** |
||
417 | * @param \CultureFeed_Cdb_Item_Event $event |
||
418 | * @param \CultureFeed_Cdb_Data_EventDetail $detail |
||
419 | * @param \stdClass $jsonLD |
||
420 | */ |
||
421 | private function importBookingInfo( |
||
422 | \CultureFeed_Cdb_Item_Event $event, |
||
423 | \CultureFeed_Cdb_Data_EventDetail $detail, |
||
424 | $jsonLD |
||
425 | ) { |
||
426 | $bookingInfo = array(); |
||
427 | |||
428 | $price = $detail->getPrice(); |
||
429 | if ($price) { |
||
430 | if ($price->getDescription()) { |
||
431 | $bookingInfo['description'] = $price->getDescription(); |
||
432 | } |
||
433 | if ($price->getTitle()) { |
||
434 | $bookingInfo['name'] = $price->getTitle(); |
||
435 | } |
||
436 | if ($price->getValue() !== null) { |
||
437 | $bookingInfo['priceCurrency'] = 'EUR'; |
||
438 | $bookingInfo['price'] = floatval($price->getValue()); |
||
439 | } |
||
440 | if ($bookingPeriod = $event->getBookingPeriod()) { |
||
441 | $startDate = $this->dateFromUdb2UnixTime($bookingPeriod->getDateFrom()); |
||
442 | $endDate = $this->dateFromUdb2UnixTime($bookingPeriod->getDateTill()); |
||
443 | |||
444 | $bookingInfo['availabilityStarts'] = $startDate->format('c'); |
||
445 | $bookingInfo['availabilityEnds'] = $endDate->format('c'); |
||
446 | } |
||
447 | } |
||
448 | |||
449 | // Add reservation contact data. |
||
450 | $contactInfo = $event->getContactInfo(); |
||
451 | if ($contactInfo) { |
||
452 | /** @var \CultureFeed_Cdb_Data_Url[] $urls */ |
||
453 | $urls = $contactInfo->getUrls(); |
||
454 | foreach ($urls as $url) { |
||
455 | if ($url->isForReservations()) { |
||
456 | $bookingInfo['url'] = $url->getUrl(); |
||
457 | break; |
||
458 | } |
||
459 | } |
||
460 | |||
461 | if (array_key_exists('url', $bookingInfo)) { |
||
462 | $bookingInfo['urlLabel'] = 'Reserveer plaatsen'; |
||
463 | } |
||
464 | |||
465 | /** @var \CultureFeed_Cdb_Data_Phone[] $phones */ |
||
466 | $phones = $contactInfo->getPhones(); |
||
467 | foreach ($phones as $phone) { |
||
468 | if ($phone->isForReservations()) { |
||
469 | $bookingInfo['phone'] = $phone->getNumber(); |
||
470 | break; |
||
471 | } |
||
472 | } |
||
473 | |||
474 | foreach ($contactInfo->getMails() as $mail) { |
||
475 | if ($mail->isForReservations()) { |
||
476 | $bookingInfo['email'] = $mail->getMailAddress(); |
||
477 | break; |
||
478 | } |
||
479 | } |
||
480 | } |
||
481 | |||
482 | if (!empty($bookingInfo)) { |
||
483 | $jsonLD->bookingInfo = $bookingInfo; |
||
484 | } |
||
485 | } |
||
486 | |||
487 | /** |
||
488 | * @param \CultureFeed_Cdb_Item_Event $event |
||
489 | * @param \stdClass $jsonLD |
||
490 | */ |
||
491 | private function importContactPoint( |
||
492 | \CultureFeed_Cdb_Item_Event $event, |
||
493 | \stdClass $jsonLD |
||
494 | ) { |
||
495 | $contactInfo = $event->getContactInfo(); |
||
496 | |||
497 | $notForReservations = function ($item) { |
||
498 | /** @var \CultureFeed_Cdb_Data_Url|\CultureFeed_Cdb_Data_Phone|\CultureFeed_Cdb_Data_Mail $item */ |
||
499 | return !$item->isForReservations(); |
||
500 | }; |
||
501 | |||
502 | if ($contactInfo) { |
||
503 | $contactPoint = array(); |
||
504 | |||
505 | $emails = array_filter($contactInfo->getMails(), $notForReservations); |
||
506 | |||
507 | View Code Duplication | if (!empty($emails)) { |
|
508 | $contactPoint['email'] = array_map( |
||
509 | function (\CultureFeed_Cdb_Data_Mail $email) { |
||
510 | return $email->getMailAddress(); |
||
511 | }, |
||
512 | $emails |
||
513 | ); |
||
514 | $contactPoint['email'] = array_values($contactPoint['email']); |
||
515 | } |
||
516 | |||
517 | $phones = array_filter($contactInfo->getPhones(), $notForReservations); |
||
518 | |||
519 | View Code Duplication | if (!empty($phones)) { |
|
520 | $contactPoint['phone'] = array_map( |
||
521 | function (\CultureFeed_Cdb_Data_phone $phone) { |
||
522 | return $phone->getNumber(); |
||
523 | }, |
||
524 | $phones |
||
525 | ); |
||
526 | $contactPoint['phone'] = array_values($contactPoint['phone']); |
||
527 | } |
||
528 | |||
529 | $urls = array_filter($contactInfo->getUrls(), $notForReservations); |
||
530 | |||
531 | View Code Duplication | if (!empty($urls)) { |
|
532 | $contactPoint['url'] = array_map( |
||
533 | function (\CultureFeed_Cdb_Data_Url $url) { |
||
534 | return $url->getUrl(); |
||
535 | }, |
||
536 | $urls |
||
537 | ); |
||
538 | $contactPoint['url'] = array_values($contactPoint['url']); |
||
539 | } |
||
540 | |||
541 | array_filter($contactPoint); |
||
542 | if (!empty($contactPoint)) { |
||
543 | $jsonLD->contactPoint = $contactPoint; |
||
544 | } |
||
545 | } |
||
546 | } |
||
547 | |||
548 | /** |
||
549 | * @param \CultureFeed_Cdb_Item_Event $event |
||
550 | * @param \stdClass $jsonLD |
||
551 | */ |
||
552 | private function importTerms(\CultureFeed_Cdb_Item_Event $event, $jsonLD) |
||
572 | |||
573 | /** |
||
574 | * @param \CultureFeed_Cdb_Item_Event $event |
||
575 | * @param \stdClass $jsonLD |
||
576 | */ |
||
577 | private function importTypicalAgeRange(\CultureFeed_Cdb_Item_Event $event, $jsonLD) |
||
578 | { |
||
579 | $ageFrom = $event->getAgeFrom(); |
||
580 | |||
581 | if (isset($ageFrom) && is_int($ageFrom)) { |
||
582 | if ($ageFrom <= 12) { |
||
593 | |||
594 | /** |
||
595 | * @param \CultureFeed_Cdb_Data_EventDetail $detail |
||
596 | * @param \stdClass $jsonLD |
||
597 | */ |
||
598 | private function importPerformers(\CultureFeed_Cdb_Data_EventDetail $detail, $jsonLD) |
||
612 | |||
613 | /** |
||
614 | * @param \CultureFeed_Cdb_Item_Event $event |
||
615 | * @param \stdClass $jsonLD |
||
616 | */ |
||
617 | private function importLanguages(\CultureFeed_Cdb_Item_Event $event, $jsonLD) |
||
629 | |||
630 | /** |
||
631 | * @param \CultureFeed_Cdb_Item_Event $event |
||
632 | * @param \stdClass $jsonLD |
||
633 | */ |
||
634 | private function importSeeAlso( |
||
655 | |||
656 | /** |
||
657 | * @param \CultureFeed_Cdb_Item_Event $event |
||
658 | * @param SluggerInterface $slugger |
||
659 | * @param \stdClass $jsonLD |
||
660 | */ |
||
661 | private function importUitInVlaanderenReference( |
||
688 | |||
689 | /** |
||
690 | * @param string $longDescription |
||
691 | * @param string $shortDescription |
||
692 | * @return bool |
||
693 | */ |
||
694 | private function longDescriptionStartsWithShortDescription( |
||
702 | } |
||
703 |
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.