-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
44 lines (35 loc) · 1.48 KB
/
index.php
File metadata and controls
44 lines (35 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
declare(strict_types=1);
require __DIR__ . '/Framework/autoload.php';
require __DIR__ . '/Framework/Database/DatabaseConnection.php';
use App\AddressManagement\Domain\Repository\PersonRepository;
use App\AddressManagement\Domain\Service\AddressManagementDomainService;
use App\AddressManagement\Presentation\Controller\AddressManagementController;
use App\AddressManagement\Presentation\Service\AddressManagementPresentationService;
use App\Content\Homepage\Presentation\Controller\HomepageController;
use JetBrains\PhpStorm\NoReturn;
$homepageController = new HomepageController();
$addressManagementController = new AddressManagementController();
$personRepository = new PersonRepository();
$addressManagementDomainService = new AddressManagementDomainService($personRepository);
$addressManagementPresentationService = new AddressManagementPresentationService($addressManagementDomainService);
$requestUri = $_SERVER['REQUEST_URI'];
if ($requestUri === '/') {
$homepageController->homepageAction();
return;
}
if ( $requestUri === '/address-management/'
|| $requestUri === '/address-management'
) {
if (!str_ends_with($requestUri, '/')) {
redirect($requestUri . '/');
}
$addressManagementController->indexAction($addressManagementPresentationService);
}
http_response_code(404);
#[NoReturn]
function redirect($url, $statusCode = 301): void
{
header('Location: ' . $url, true, $statusCode);
die();
}