Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
6 / 6 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
DomainControllerBase | |
100.00% |
6 / 6 |
|
100.00% |
3 / 3 |
4 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
createViewActionResult | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
redirectPath | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
2 |
1 | <?php |
2 | |
3 | declare(strict_types=1); |
4 | |
5 | namespace PeServer\App\Controllers; |
6 | |
7 | use PeServer\App\Models\AppConfiguration; |
8 | use PeServer\App\Models\AppTemplateOptions; |
9 | use PeServer\App\Models\AppUrl; |
10 | use PeServer\App\Models\AppViewActionResult; |
11 | use PeServer\Core\DI\Inject; |
12 | use PeServer\Core\Mvc\ControllerArgument; |
13 | use PeServer\Core\Mvc\ControllerBase; |
14 | use PeServer\Core\Mvc\Result\RedirectActionResult; |
15 | use PeServer\Core\Mvc\Result\ViewActionResult; |
16 | use PeServer\Core\Mvc\Template\ITemplateFactory; |
17 | use PeServer\Core\Mvc\Template\TemplateParameter; |
18 | use PeServer\Core\ProgramContext; |
19 | use PeServer\Core\Web\IUrlHelper; |
20 | use PeServer\Core\Web\UrlPath; |
21 | use PeServer\Core\Web\UrlQuery; |
22 | use PeServer\Core\Web\WebSecurity; |
23 | |
24 | /** |
25 | * アプリケーションコントローラ基底処理。 |
26 | */ |
27 | abstract class DomainControllerBase extends ControllerBase |
28 | { |
29 | #region variable |
30 | |
31 | #[Inject] //@phpstan-ignore-next-line [INJECT] |
32 | private AppUrl $appUrl; |
33 | |
34 | #endregion |
35 | |
36 | protected function __construct(ControllerArgument $argument) |
37 | { |
38 | parent::__construct($argument); |
39 | } |
40 | |
41 | #region ControllerBase |
42 | |
43 | protected function createViewActionResult( |
44 | string $templateBaseName, |
45 | string $actionName, |
46 | TemplateParameter $templateParameter, |
47 | array $headers, |
48 | ProgramContext $programContext, |
49 | ITemplateFactory $templateFactory, |
50 | IUrlHelper $urlHelper, |
51 | WebSecurity $webSecurity |
52 | ): ViewActionResult { |
53 | return new AppViewActionResult($templateBaseName, $actionName, $templateParameter, $headers, $programContext, $templateFactory, $urlHelper, $webSecurity); |
54 | } |
55 | |
56 | protected function redirectPath(UrlPath|string $path, ?UrlQuery $query = null): RedirectActionResult |
57 | { |
58 | //NOTE: リダイレクトURLは設定から取得するためオーバーライドしている |
59 | |
60 | if (is_string($path)) { |
61 | $path = new UrlPath($path); |
62 | } |
63 | |
64 | $url = $this->appUrl->addPublicUrl($path, $query); |
65 | |
66 | return parent::redirectUrl($url); |
67 | } |
68 | |
69 | #endregion |
70 | } |