Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
41.67% |
5 / 12 |
|
25.00% |
1 / 4 |
CRAP | |
0.00% |
0 / 1 |
ApplicationApiController | |
41.67% |
5 / 12 |
|
25.00% |
1 / 4 |
9.96 | |
0.00% |
0 / 1 |
__construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
feedback | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
crash_report | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
version_update | |
80.00% |
4 / 5 |
|
0.00% |
0 / 1 |
2.03 |
1 | <?php |
2 | |
3 | declare(strict_types=1); |
4 | |
5 | namespace PeServer\App\Controllers\Api; |
6 | |
7 | use PeServer\App\Controllers\Api\ApiControllerBase; |
8 | use PeServer\App\Models\Domain\Api\ApplicationApi\ApplicationApiCrashReportLogic; |
9 | use PeServer\App\Models\Domain\Api\ApplicationApi\ApplicationApiFeedbackLogic; |
10 | use PeServer\App\Models\Domain\Api\ApplicationApi\ApplicationApiVersionUpdateLogic; |
11 | use PeServer\Core\Http\HttpStatus; |
12 | use PeServer\Core\Mvc\ControllerArgument; |
13 | use PeServer\Core\Mvc\LogicCallMode; |
14 | use PeServer\Core\Mvc\Result\IActionResult; |
15 | use PeServer\Core\Mvc\Result\RedirectActionResult; |
16 | use PeServer\Core\Throws\InvalidOperationException; |
17 | |
18 | /** |
19 | * [API] Peから呼び出されるコントローラ。 |
20 | * |
21 | * 管理やら開発都合でなくユーザー用に外向いているのはこいつ(1)。 |
22 | */ |
23 | class ApplicationApiController extends ApiControllerBase |
24 | { |
25 | public function __construct(ControllerArgument $argument) |
26 | { |
27 | parent::__construct($argument); |
28 | } |
29 | |
30 | #region function |
31 | |
32 | public function feedback(): IActionResult |
33 | { |
34 | $logic = $this->createLogic(ApplicationApiFeedbackLogic::class); |
35 | $logic->run(LogicCallMode::Submit); |
36 | |
37 | return $this->data($logic->getContent()); |
38 | } |
39 | |
40 | public function crash_report(): IActionResult |
41 | { |
42 | $logic = $this->createLogic(ApplicationApiCrashReportLogic::class); |
43 | $logic->run(LogicCallMode::Submit); |
44 | |
45 | return $this->data($logic->getContent()); |
46 | } |
47 | |
48 | public function version_update(): IActionResult |
49 | { |
50 | /** @var ApplicationApiVersionUpdateLogic */ |
51 | $logic = $this->createLogic(ApplicationApiVersionUpdateLogic::class); |
52 | $logic->run(LogicCallMode::Submit); |
53 | |
54 | if ($logic->redirectUrl === null) { |
55 | throw new InvalidOperationException(); |
56 | } |
57 | |
58 | return new RedirectActionResult($logic->redirectUrl, HttpStatus::Found); |
59 | } |
60 | |
61 | #endregion |
62 | } |