UserRegistrationController::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 0
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Extension "sf_event_mgt" for TYPO3 CMS.
7
 *
8
 * For the full copyright and license information, please read the
9
 * LICENSE.txt file that was distributed with this source code.
10
 */
11
12
namespace DERHANSEN\SfEventMgt\Controller;
13
14
use DERHANSEN\SfEventMgt\Domain\Model\Dto\UserRegistrationDemand;
15
use DERHANSEN\SfEventMgt\Domain\Model\Registration;
16
use Psr\Http\Message\ResponseInterface;
17
use TYPO3\CMS\Core\Context\Context;
18
19
class UserRegistrationController extends AbstractController
20
{
21
    public function __construct(
22
        protected readonly Context $context,
23
    ) {
24
    }
25
26
    /**
27
     * Shows a list of all registration of the current frontend user
28
     */
29
    public function listAction(): ResponseInterface
30
    {
31
        $demand = UserRegistrationDemand::createFromSettings($this->settings);
32
        $demand->setUser($this->registrationService->getCurrentFeUserObject());
33
        $registrations = $this->registrationRepository->findRegistrationsByUserRegistrationDemand($demand);
34
        $this->view->assign('registrations', $registrations);
35
36
        return $this->htmlResponse();
37
    }
38
39
    /**
40
     * Shows a detail page for the given registration
41
     */
42
    public function detailAction(Registration $registration): ResponseInterface
43
    {
44
        $this->registrationService->checkRegistrationAccess($this->request, $registration);
45
        $this->view->assign('registration', $registration);
46
47
        return $this->htmlResponse();
48
    }
49
}
50