Complex classes like EventController 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 EventController, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
36 | class EventController extends AbstractController |
||
37 | { |
||
38 | /** |
||
39 | * @var EventCacheService |
||
40 | */ |
||
41 | protected $eventCacheService = null; |
||
42 | |||
43 | /** |
||
44 | * @param EventCacheService $cacheService |
||
45 | */ |
||
46 | public function injectEventCacheService(EventCacheService $cacheService) |
||
47 | { |
||
48 | $this->eventCacheService = $cacheService; |
||
49 | } |
||
50 | |||
51 | /** |
||
52 | * Assign contentObjectData and pageData to earch view |
||
53 | * |
||
54 | * @param \TYPO3\CMS\Extbase\Mvc\View\ViewInterface $view |
||
55 | */ |
||
56 | protected function initializeView(\TYPO3\CMS\Extbase\Mvc\View\ViewInterface $view) |
||
57 | { |
||
58 | $view->assign('contentObjectData', $this->configurationManager->getContentObject()->data); |
||
59 | if (is_object($GLOBALS['TSFE'])) { |
||
60 | $view->assign('pageData', $GLOBALS['TSFE']->page); |
||
61 | } |
||
62 | parent::initializeView($view); |
||
63 | } |
||
64 | |||
65 | /** |
||
66 | * Initializes the current action |
||
67 | */ |
||
68 | public function initializeAction() |
||
69 | { |
||
70 | $typoScriptFrontendController = $this->getTypoScriptFrontendController(); |
||
71 | if ($typoScriptFrontendController !== null) { |
||
72 | static $cacheTagsSet = false; |
||
73 | |||
74 | if (!$cacheTagsSet) { |
||
75 | $typoScriptFrontendController->addCacheTags(['tx_sfeventmgt']); |
||
76 | $cacheTagsSet = true; |
||
77 | } |
||
78 | } |
||
79 | } |
||
80 | |||
81 | /** |
||
82 | * Creates an event demand object with the given settings |
||
83 | * |
||
84 | * @param array $settings The settings |
||
85 | * |
||
86 | * @return \DERHANSEN\SfEventMgt\Domain\Model\Dto\EventDemand |
||
87 | */ |
||
88 | public function createEventDemandObjectFromSettings(array $settings) |
||
89 | { |
||
90 | /** @var \DERHANSEN\SfEventMgt\Domain\Model\Dto\EventDemand $demand */ |
||
91 | $demand = $this->objectManager->get(EventDemand::class); |
||
92 | $demand->setDisplayMode($settings['displayMode']); |
||
93 | $demand->setStoragePage(Page::extendPidListByChildren($settings['storagePage'], $settings['recursive'])); |
||
94 | $demand->setCategoryConjunction($settings['categoryConjunction']); |
||
95 | $demand->setCategory($settings['category']); |
||
96 | $demand->setIncludeSubcategories($settings['includeSubcategories']); |
||
97 | $demand->setTopEventRestriction((int)$settings['topEventRestriction']); |
||
98 | $demand->setOrderField($settings['orderField']); |
||
99 | $demand->setOrderFieldAllowed($settings['orderFieldAllowed']); |
||
100 | $demand->setOrderDirection($settings['orderDirection']); |
||
101 | $demand->setQueryLimit($settings['queryLimit']); |
||
102 | $demand->setLocation($settings['location']); |
||
103 | $demand->setOrganisator($settings['organisator']); |
||
104 | $demand->setSpeaker($settings['speaker']); |
||
105 | |||
106 | return $demand; |
||
107 | } |
||
108 | |||
109 | /** |
||
110 | * Creates a foreign record demand object with the given settings |
||
111 | * |
||
112 | * @param array $settings The settings |
||
113 | * |
||
114 | * @return \DERHANSEN\SfEventMgt\Domain\Model\Dto\ForeignRecordDemand |
||
115 | */ |
||
116 | public function createForeignRecordDemandObjectFromSettings(array $settings) |
||
117 | { |
||
118 | /** @var \DERHANSEN\SfEventMgt\Domain\Model\Dto\ForeignRecordDemand $demand */ |
||
119 | $demand = $this->objectManager->get(ForeignRecordDemand::class); |
||
120 | $demand->setStoragePage(Page::extendPidListByChildren($settings['storagePage'], $settings['recursive'])); |
||
121 | $demand->setRestrictForeignRecordsToStoragePage((bool)$settings['restrictForeignRecordsToStoragePage']); |
||
122 | |||
123 | return $demand; |
||
124 | } |
||
125 | |||
126 | /** |
||
127 | * Creates a category demand object with the given settings |
||
128 | * |
||
129 | * @param array $settings The settings |
||
130 | * |
||
131 | * @return \DERHANSEN\SfEventMgt\Domain\Model\Dto\CategoryDemand |
||
132 | */ |
||
133 | public function createCategoryDemandObjectFromSettings(array $settings) |
||
134 | { |
||
135 | /** @var \DERHANSEN\SfEventMgt\Domain\Model\Dto\CategoryDemand $demand */ |
||
136 | $demand = $this->objectManager->get(CategoryDemand::class); |
||
137 | 2 | $demand->setStoragePage(Page::extendPidListByChildren($settings['storagePage'], $settings['recursive'])); |
|
138 | $demand->setRestrictToStoragePage((bool)$settings['restrictForeignRecordsToStoragePage']); |
||
139 | $demand->setCategories($settings['categoryMenu']['categories']); |
||
140 | 2 | $demand->setIncludeSubcategories($settings['categoryMenu']['includeSubcategories']); |
|
141 | 2 | ||
142 | 2 | return $demand; |
|
143 | 2 | } |
|
144 | 2 | ||
145 | 2 | /** |
|
146 | 2 | * Hook into request processing and catch exceptions |
|
147 | 2 | * |
|
148 | 2 | * @param RequestInterface $request |
|
149 | 2 | * @param ResponseInterface $response |
|
150 | 2 | * @throws \Exception |
|
151 | 2 | */ |
|
152 | public function processRequest(RequestInterface $request, ResponseInterface $response) |
||
160 | |||
161 | /** |
||
162 | * Handle known exceptions |
||
163 | * |
||
164 | * @param \Exception $exception |
||
165 | * @throws \Exception |
||
166 | */ |
||
167 | private function handleKnownExceptionsElseThrowAgain(\Exception $exception) |
||
179 | |||
180 | 2 | /** |
|
181 | 2 | * Initialize list action and set format |
|
182 | 2 | * |
|
183 | 2 | * @return void |
|
184 | 2 | */ |
|
185 | 2 | public function initializeListAction() |
|
191 | |||
192 | /** |
||
193 | * List view |
||
194 | * |
||
195 | * @param array $overwriteDemand OverwriteDemand |
||
196 | 4 | * |
|
197 | * @return void |
||
198 | 4 | */ |
|
199 | 4 | public function listAction(array $overwriteDemand = []) |
|
228 | |||
229 | /** |
||
230 | 6 | * Calendar view |
|
231 | * |
||
232 | 6 | * @param array $overwriteDemand OverwriteDemand |
|
233 | 6 | * |
|
234 | 6 | * @return void |
|
235 | 6 | */ |
|
236 | 2 | public function calendarAction(array $overwriteDemand = []) |
|
237 | 2 | { |
|
238 | 6 | $eventDemand = $this->createEventDemandObjectFromSettings($this->settings); |
|
239 | 6 | $foreignRecordDemand = $this->createForeignRecordDemandObjectFromSettings($this->settings); |
|
240 | 6 | $categoryDemand = $this->createCategoryDemandObjectFromSettings($this->settings); |
|
241 | 6 | if ($this->isOverwriteDemand($overwriteDemand)) { |
|
242 | 6 | $eventDemand = $this->overwriteEventDemandObject($eventDemand, $overwriteDemand); |
|
243 | 6 | } |
|
244 | 6 | ||
245 | 6 | // Set month/year to demand if not given |
|
246 | if (!$eventDemand->getMonth()) { |
||
247 | $currentMonth = date('n'); |
||
248 | $eventDemand->setMonth($currentMonth); |
||
249 | } else { |
||
250 | $currentMonth = $eventDemand->getMonth(); |
||
251 | } |
||
252 | if (!$eventDemand->getYear()) { |
||
253 | $currentYear = date('Y'); |
||
254 | 2 | $eventDemand->setYear($currentYear); |
|
255 | } else { |
||
256 | 2 | $currentYear = $eventDemand->getYear(); |
|
257 | 2 | } |
|
258 | |||
259 | // Set demand from calendar date range instead of month / year |
||
260 | if ((bool)$this->settings['calendar']['includeEventsForEveryDayOfAllCalendarWeeks']) { |
||
261 | $eventDemand = $this->changeEventDemandToFullMonthDateRange($eventDemand); |
||
262 | } |
||
263 | |||
264 | $events = $this->eventRepository->findDemanded($eventDemand); |
||
265 | $weeks = $this->calendarService->getCalendarArray( |
||
266 | 2 | $currentMonth, |
|
267 | $currentYear, |
||
268 | 2 | strtotime('today midnight'), |
|
269 | 2 | (int)$this->settings['calendar']['firstDayOfWeek'], |
|
270 | $events |
||
271 | ); |
||
272 | |||
273 | $values = [ |
||
274 | 'events' => $events, |
||
275 | 'weeks' => $weeks, |
||
276 | 'categories' => $this->categoryRepository->findDemanded($categoryDemand), |
||
277 | 'locations' => $this->locationRepository->findDemanded($foreignRecordDemand), |
||
278 | 'organisators' => $this->organisatorRepository->findDemanded($foreignRecordDemand), |
||
279 | 2 | 'eventDemand' => $eventDemand, |
|
280 | 'overwriteDemand' => $overwriteDemand, |
||
281 | 2 | 'currentPageId' => $GLOBALS['TSFE']->id, |
|
282 | 'firstDayOfMonth' => \DateTime::createFromFormat('d.m.Y', sprintf('1.%s.%s', $currentMonth, $currentYear)), |
||
283 | 'previousMonthConfig' => $this->calendarService->getDateConfig($currentMonth, $currentYear, '-1 month'), |
||
284 | 2 | 'nextMonthConfig' => $this->calendarService->getDateConfig($currentMonth, $currentYear, '+1 month') |
|
285 | ]; |
||
286 | 2 | ||
287 | 2 | $this->signalDispatch(__CLASS__, __FUNCTION__ . 'BeforeRenderView', [&$values, $this]); |
|
288 | 2 | $this->view->assignMultiple($values); |
|
289 | } |
||
290 | |||
291 | /** |
||
292 | * Changes the given event demand object to select a date range for a calendar month including days of the previous |
||
293 | * month for the first week and they days for the next month for the last week |
||
294 | * |
||
295 | 2 | * @param EventDemand $eventDemand |
|
296 | * @return EventDemand |
||
297 | 2 | */ |
|
298 | 2 | protected function changeEventDemandToFullMonthDateRange(EventDemand $eventDemand) |
|
322 | 22 | ||
323 | 8 | /** |
|
324 | 8 | * Detail view for an event |
|
325 | 8 | * |
|
326 | 8 | * @param \DERHANSEN\SfEventMgt\Domain\Model\Event $event Event |
|
327 | 8 | * @return mixed string|void |
|
328 | 8 | */ |
|
329 | public function detailAction(Event $event = null) |
||
347 | |||
348 | 8 | /** |
|
349 | 2 | * Error handling if event is not found |
|
350 | 2 | * |
|
351 | 2 | * @param array $settings |
|
352 | 6 | * @return string |
|
353 | 6 | */ |
|
354 | protected function handleEventNotFoundError($settings) |
||
383 | 2 | ||
384 | 2 | /** |
|
385 | 2 | * Initiates the iCalendar download for the given event |
|
386 | 2 | * |
|
387 | * @param Event $event The event |
||
388 | 2 | * |
|
389 | 2 | * @return string|false |
|
390 | 2 | */ |
|
391 | 2 | public function icalDownloadAction(Event $event = null) |
|
402 | |||
403 | /** |
||
404 | * Registration view for an event |
||
405 | * |
||
406 | * @param \DERHANSEN\SfEventMgt\Domain\Model\Event $event Event |
||
407 | * |
||
408 | * @return mixed string|void |
||
409 | 18 | */ |
|
410 | public function registrationAction(Event $event = null) |
||
433 | 2 | ||
434 | 2 | /** |
|
435 | 2 | * Removes all possible spamcheck fields (which do not belong to the domain model) from arguments. |
|
436 | 8 | * |
|
437 | 2 | * @return void |
|
438 | 2 | */ |
|
439 | 2 | protected function removePossibleSpamCheckFieldsFromArguments() |
|
440 | 6 | { |
|
441 | 2 | $arguments = $this->request->getArguments(); |
|
442 | 2 | if (!isset($arguments['event'])) { |
|
443 | 2 | return; |
|
444 | 4 | } |
|
445 | 2 | ||
446 | 2 | // Remove a possible honeypot field |
|
447 | 2 | $honeypotField = 'hp' . (int)$arguments['event']; |
|
448 | 2 | if (isset($arguments['registration'][$honeypotField])) { |
|
449 | 2 | unset($arguments['registration'][$honeypotField]); |
|
450 | 2 | } |
|
451 | 2 | ||
452 | // Remove a possible challenge/response field |
||
453 | 18 | if (isset($arguments['registration']['cr-response'])) { |
|
454 | 18 | unset($arguments['registration']['cr-response']); |
|
455 | 18 | } |
|
456 | |||
457 | $this->request->setArguments($arguments); |
||
458 | } |
||
459 | |||
460 | /** |
||
461 | * Processes incoming registrations fields and adds field values to arguments |
||
462 | * |
||
463 | * @return void |
||
464 | */ |
||
465 | 6 | protected function setRegistrationFieldValuesToArguments() |
|
466 | { |
||
467 | $arguments = $this->request->getArguments(); |
||
468 | 6 | if (!isset($arguments['event'])) { |
|
469 | return; |
||
470 | 6 | } |
|
471 | 4 | ||
472 | 4 | /** @var Event $event */ |
|
473 | $event = $this->eventRepository->findByUid((int)$this->request->getArgument('event')); |
||
474 | 4 | if (!$event || $event->getRegistrationFields()->count() === 0) { |
|
475 | 4 | return; |
|
476 | 2 | } |
|
477 | 2 | ||
478 | $registrationMvcArgument = $this->arguments->getArgument('registration'); |
||
479 | $propertyMapping = $registrationMvcArgument->getPropertyMappingConfiguration(); |
||
480 | 4 | $propertyMapping->allowProperties('fieldValues'); |
|
481 | 4 | $propertyMapping->allowCreationForSubProperty('fieldValues'); |
|
482 | 4 | $propertyMapping->allowModificationForSubProperty('fieldValues'); |
|
483 | 4 | ||
484 | // allow creation of new objects (for validation) |
||
485 | 4 | $propertyMapping->setTypeConverterOptions( |
|
486 | 4 | PersistentObjectConverter::class, |
|
487 | 4 | [ |
|
488 | 4 | PersistentObjectConverter::CONFIGURATION_CREATION_ALLOWED => true, |
|
489 | 4 | PersistentObjectConverter::CONFIGURATION_MODIFICATION_ALLOWED => true |
|
490 | ] |
||
491 | 4 | ); |
|
492 | |||
493 | // Set event to registration (required for validation) |
||
494 | 4 | $propertyMapping->allowProperties('event'); |
|
495 | 4 | $propertyMapping->allowCreationForSubProperty('event'); |
|
496 | 4 | $propertyMapping->allowModificationForSubProperty('event'); |
|
497 | 4 | $arguments['registration']['event'] = (int)$this->request->getArgument('event'); |
|
498 | |||
499 | $index = 0; |
||
500 | 6 | foreach ((array)$arguments['registration']['fields'] as $fieldUid => $value) { |
|
501 | 6 | // Only accept registration fields of the current event |
|
502 | if (!in_array((int)$fieldUid, $event->getRegistrationFieldsUids(), true)) { |
||
503 | continue; |
||
504 | } |
||
505 | |||
506 | // allow subvalues in new property mapper |
||
507 | $propertyMapping->forProperty('fieldValues')->allowProperties($index); |
||
508 | $propertyMapping->forProperty('fieldValues.' . $index)->allowAllProperties(); |
||
509 | $propertyMapping->allowCreationForSubProperty('fieldValues.' . $index); |
||
510 | $propertyMapping->allowModificationForSubProperty('fieldValues.' . $index); |
||
511 | |||
512 | if (is_array($value)) { |
||
513 | if (empty($value)) { |
||
514 | $value = ''; |
||
515 | } else { |
||
516 | $value = json_encode($value); |
||
517 | } |
||
518 | 6 | } |
|
519 | 6 | ||
520 | 6 | /** @var Registration\Field $field */ |
|
521 | $field = $this->fieldRepository->findByUid((int)$fieldUid); |
||
522 | |||
523 | $arguments['registration']['fieldValues'][$index] = [ |
||
524 | 'pid' => $field->getPid(), |
||
525 | 'value' => $value, |
||
526 | 'field' => strval($fieldUid), |
||
527 | 'valueType' => $field->getValueType() |
||
528 | ]; |
||
529 | |||
530 | 4 | $index++; |
|
531 | } |
||
532 | |||
533 | 4 | // Remove temporary "fields" field |
|
534 | if (isset($arguments['registration']['fields'])) { |
||
535 | 4 | $arguments = ArrayUtility::removeByPath($arguments, 'registration/fields'); |
|
536 | } |
||
537 | 2 | $this->request->setArguments($arguments); |
|
538 | 2 | } |
|
539 | 2 | ||
540 | 2 | /** |
|
541 | * Set date format for field dateOfBirth |
||
542 | 2 | * |
|
543 | 2 | * @return void |
|
544 | 2 | */ |
|
545 | 2 | public function initializeSaveRegistrationAction() |
|
546 | 2 | { |
|
547 | $this->arguments->getArgument('registration') |
||
548 | 2 | ->getPropertyMappingConfiguration()->forProperty('dateOfBirth') |
|
549 | ->setTypeConverterOption( |
||
550 | DateTimeConverter::class, |
||
551 | 2 | DateTimeConverter::CONFIGURATION_DATE_FORMAT, |
|
552 | 2 | $this->settings['registration']['formatDateOfBirth'] |
|
553 | 2 | ); |
|
554 | $this->removePossibleSpamCheckFieldsFromArguments(); |
||
555 | $this->setRegistrationFieldValuesToArguments(); |
||
556 | 2 | } |
|
557 | |||
558 | /** |
||
559 | 2 | * Saves the registration |
|
560 | 2 | * |
|
561 | 4 | * @param \DERHANSEN\SfEventMgt\Domain\Model\Registration $registration Registration |
|
562 | 4 | * @param \DERHANSEN\SfEventMgt\Domain\Model\Event $event Event |
|
563 | 4 | * @validate $registration \DERHANSEN\SfEventMgt\Validation\Validator\RegistrationFieldValidator |
|
564 | * @validate $registration \DERHANSEN\SfEventMgt\Validation\Validator\RegistrationValidator |
||
565 | * |
||
566 | * @return mixed string|void |
||
567 | */ |
||
568 | public function saveRegistrationAction(Registration $registration, Event $event) |
||
569 | { |
||
570 | 2 | if (is_a($event, Event::class) && $this->settings['registration']['checkPidOfEventRecord']) { |
|
571 | $event = $this->checkPidOfEventRecord($event); |
||
572 | 2 | } |
|
573 | 2 | if (is_null($event) && isset($this->settings['event']['errorHandling'])) { |
|
574 | 2 | return $this->handleEventNotFoundError($this->settings); |
|
575 | 2 | } |
|
576 | 2 | $autoConfirmation = (bool)$this->settings['registration']['autoConfirmation'] || $event->getEnableAutoconfirm(); |
|
577 | 2 | $result = RegistrationResult::REGISTRATION_SUCCESSFUL; |
|
578 | 2 | list($success, $result) = $this->registrationService->checkRegistrationSuccess($event, $registration, $result); |
|
579 | 2 | ||
580 | 2 | // Save registration if no errors |
|
581 | 2 | if ($success) { |
|
582 | 2 | $isWaitlistRegistration = $this->registrationService->isWaitlistRegistration( |
|
583 | 2 | $event, |
|
584 | 2 | $registration->getAmountOfRegistrations() |
|
585 | 2 | ); |
|
586 | 2 | $linkValidity = (int)$this->settings['confirmation']['linkValidity']; |
|
587 | 2 | if ($linkValidity === 0) { |
|
588 | 2 | // Use 3600 seconds as default value if not set |
|
589 | $linkValidity = 3600; |
||
590 | } |
||
591 | $confirmationUntil = new \DateTime(); |
||
592 | $confirmationUntil->add(new \DateInterval('PT' . $linkValidity . 'S')); |
||
593 | |||
594 | $registration->setEvent($event); |
||
595 | $registration->setPid($event->getPid()); |
||
596 | $registration->setConfirmationUntil($confirmationUntil); |
||
597 | $registration->setLanguage($GLOBALS['TSFE']->config['config']['language']); |
||
598 | 12 | $registration->setFeUser($this->registrationService->getCurrentFeUserObject()); |
|
599 | $registration->setWaitlist($isWaitlistRegistration); |
||
600 | 12 | $registration->_setProperty('_languageUid', $this->getSysLanguageUid()); |
|
601 | 12 | $this->registrationRepository->add($registration); |
|
602 | 12 | ||
603 | 12 | // Persist registration, so we have an UID |
|
604 | $this->objectManager->get(PersistenceManager::class)->persistAll(); |
||
605 | 12 | ||
606 | 10 | if ($isWaitlistRegistration) { |
|
607 | $messageType = MessageType::REGISTRATION_WAITLIST_NEW; |
||
608 | 10 | } else { |
|
609 | 2 | $messageType = MessageType::REGISTRATION_NEW; |
|
610 | 2 | } |
|
611 | |||
612 | 10 | // Fix event in registration for language other than default language |
|
613 | 2 | $this->registrationService->fixRegistrationEvent($registration, $event); |
|
614 | 2 | ||
615 | 10 | $this->signalDispatch(__CLASS__, __FUNCTION__ . 'AfterRegistrationSaved', [$registration, $this]); |
|
616 | |||
617 | 12 | // Send notifications to user and admin if confirmation link should be sent |
|
618 | 2 | if (!$autoConfirmation) { |
|
619 | 2 | $this->notificationService->sendUserMessage( |
|
620 | $event, |
||
621 | 12 | $registration, |
|
622 | 12 | $this->settings, |
|
623 | $messageType |
||
624 | 12 | ); |
|
625 | $this->notificationService->sendAdminMessage( |
||
626 | 12 | $event, |
|
627 | 12 | $registration, |
|
628 | 12 | $this->settings, |
|
629 | 12 | $messageType |
|
630 | 12 | ); |
|
631 | 12 | } |
|
632 | |||
633 | // Create given amount of registrations if necessary |
||
634 | $createDependingRegistrations = $registration->getAmountOfRegistrations() > 1; |
||
635 | $this->signalDispatch( |
||
636 | __CLASS__, |
||
637 | __FUNCTION__ . 'BeforeCreateDependingRegistrations', |
||
638 | [$registration, &$createDependingRegistrations, $this] |
||
639 | 18 | ); |
|
640 | if ($createDependingRegistrations) { |
||
641 | 18 | $this->registrationService->createDependingRegistrations($registration); |
|
642 | } |
||
643 | |||
644 | // Flush page cache for event, since new registration has been added |
||
645 | $this->eventCacheService->flushEventCache($event->getUid(), $event->getPid()); |
||
646 | } |
||
647 | |||
648 | if ($autoConfirmation && $success) { |
||
649 | $this->redirect( |
||
650 | 'confirmRegistration', |
||
651 | null, |
||
652 | null, |
||
653 | [ |
||
654 | 'reguid' => $registration->getUid(), |
||
655 | 'hmac' => $this->hashService->generateHmac('reg-' . $registration->getUid()) |
||
656 | ] |
||
657 | ); |
||
658 | } else { |
||
659 | $this->redirect( |
||
660 | 'saveRegistrationResult', |
||
661 | null, |
||
662 | null, |
||
663 | [ |
||
664 | 'result' => $result, |
||
665 | 'eventuid' => $event->getUid(), |
||
666 | 'hmac' => $this->hashService->generateHmac('event-' . $event->getUid()) |
||
667 | ] |
||
668 | ); |
||
669 | } |
||
670 | } |
||
671 | |||
672 | /** |
||
673 | * Shows the result of the saveRegistrationAction |
||
674 | * |
||
675 | * @param int $result Result |
||
676 | * @param int $eventuid |
||
677 | * @param string $hmac |
||
678 | * |
||
679 | * @return void |
||
680 | */ |
||
681 | public function saveRegistrationResultAction($result, $eventuid, $hmac) |
||
740 | |||
741 | /** |
||
742 | * Confirms the registration if possible and sends e-mails to admin and user |
||
743 | * |
||
744 | * @param int $reguid UID of registration |
||
745 | * @param string $hmac HMAC for parameters |
||
746 | * |
||
747 | * @return void |
||
748 | */ |
||
749 | public function confirmRegistrationAction($reguid, $hmac) |
||
821 | |||
822 | /** |
||
823 | * Cancels the registration if possible and sends e-mails to admin and user |
||
824 | * |
||
825 | * @param int $reguid UID of registration |
||
826 | * @param string $hmac HMAC for parameters |
||
827 | * |
||
828 | * @return void |
||
829 | */ |
||
830 | public function cancelRegistrationAction($reguid, $hmac) |
||
879 | |||
880 | /** |
||
881 | * Set date format for field startDate and endDate |
||
882 | * |
||
883 | * @return void |
||
884 | */ |
||
885 | public function initializeSearchAction() |
||
914 | |||
915 | /** |
||
916 | * Search view |
||
917 | * |
||
918 | * @param \DERHANSEN\SfEventMgt\Domain\Model\Dto\SearchDemand $searchDemand SearchDemand |
||
919 | * @param array $overwriteDemand OverwriteDemand |
||
920 | * |
||
921 | * @return void |
||
922 | */ |
||
923 | public function searchAction(SearchDemand $searchDemand = null, array $overwriteDemand = []) |
||
965 | |||
966 | /** |
||
967 | * Returns if a demand object can be overwritten with the given overwriteDemand array |
||
968 | * |
||
969 | * @param array $overwriteDemand |
||
970 | * @return bool |
||
971 | */ |
||
972 | protected function isOverwriteDemand($overwriteDemand) |
||
976 | |||
977 | /** |
||
978 | * If no event is given and the singleEvent setting is set, the configured single event is returned |
||
979 | * |
||
980 | * @param Event|null $event |
||
981 | * @return Event|null |
||
982 | */ |
||
983 | protected function evaluateSingleEventSetting($event) |
||
991 | |||
992 | /** |
||
993 | * If no event is given and the isShortcut setting is set, the event is displayed using the "Insert Record" |
||
994 | * content element and should be loaded from contect object data |
||
995 | * |
||
996 | * @param Event|null $event |
||
997 | * @return Event|null |
||
998 | */ |
||
999 | protected function evaluateIsShortcutSetting($event) |
||
1008 | |||
1009 | /** |
||
1010 | * Checks if the event pid could be found in the storagePage settings of the detail plugin and |
||
1011 | * if the pid could not be found it return null instead of the event object. |
||
1012 | * |
||
1013 | * @param \DERHANSEN\SfEventMgt\Domain\Model\Event $event |
||
1014 | * @return null|\DERHANSEN\SfEventMgt\Domain\Model\Event |
||
1015 | */ |
||
1016 | protected function checkPidOfEventRecord(Event $event) |
||
1040 | |||
1041 | /** |
||
1042 | * Returns the current sys_language_uid |
||
1043 | * |
||
1044 | * @return int |
||
1045 | */ |
||
1046 | protected function getSysLanguageUid() |
||
1050 | } |
||
1051 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.