-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathedit.php
More file actions
38 lines (33 loc) · 1.1 KB
/
edit.php
File metadata and controls
38 lines (33 loc) · 1.1 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
<?php
declare(strict_types=1);
use Solid\App\BlogPost\Application\Find\FindUseCase;
use Solid\App\BlogPost\Application\Modify\ModifyUseCase;
use Solid\App\BlogPost\Domain\Service\Factory;
use Solid\App\BlogPost\Infrastructure\Normalizer\ReflectionNormalizer;
use Solid\App\BlogPost\Infrastructure\Persistence\Storage\FileStorage;
use Solid\App\BlogPost\Presentation\Controller\EditAction;
use Solid\App\BlogPost\Presentation\Renderer\HtmlRenderer;
use Solid\App\Shared\Domain\Exception\FormatExceptionRenderer;
use Solid\App\Shared\Domain\Exception\HtmlExceptionRenderer;
use Solid\App\Shared\Domain\Exception\JsonExceptionRenderer;
require __DIR__.'/../../../vendor/autoload.php';
$storageDir = __DIR__.'/../../../var/data';
$storage = new FileStorage(
new ReflectionNormalizer(),
$storageDir,
);
$action = new EditAction(
new FindUseCase(
$storage,
),
new ModifyUseCase(
new Factory(),
$storage,
),
new HtmlRenderer(),
);
try {
$action((int) ($_GET['id'] ?? 0));
} catch (RuntimeException $exception) {
(new HtmlExceptionRenderer())->render($exception);
}