Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
14 / 14 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
ApplicationApiVersionUpdateLogic | |
100.00% |
14 / 14 |
|
100.00% |
3 / 3 |
3 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
validateImpl | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
executeImpl | |
100.00% |
12 / 12 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | declare(strict_types=1); |
4 | |
5 | namespace PeServer\App\Models\Domain\Api\ApplicationApi; |
6 | |
7 | use Exception; |
8 | use PeServer\App\Models\AppConfiguration; |
9 | use PeServer\App\Models\AppMailer; |
10 | use PeServer\App\Models\AppTemplate; |
11 | use PeServer\App\Models\AuditLog; |
12 | use PeServer\App\Models\Dao\Entities\FeedbacksEntityDao; |
13 | use PeServer\App\Models\Dao\Entities\PeSettingEntityDao; |
14 | use PeServer\App\Models\Dao\Entities\SequenceEntityDao; |
15 | use PeServer\App\Models\Domain\Api\ApiLogicBase; |
16 | use PeServer\App\Models\ResponseJson; |
17 | use PeServer\Core\Database\IDatabaseContext; |
18 | use PeServer\Core\Mail\Attachment; |
19 | use PeServer\Core\Mail\EmailAddress; |
20 | use PeServer\Core\Mail\EmailMessage; |
21 | use PeServer\Core\Mime; |
22 | use PeServer\Core\Mvc\LogicCallMode; |
23 | use PeServer\Core\Mvc\LogicParameter; |
24 | use PeServer\Core\Text; |
25 | use PeServer\Core\Throws\NotImplementedException; |
26 | use PeServer\Core\Web\Url; |
27 | |
28 | class ApplicationApiVersionUpdateLogic extends ApiLogicBase |
29 | { |
30 | #region variable |
31 | |
32 | public Url|null $redirectUrl = null; |
33 | |
34 | #endregion |
35 | |
36 | public function __construct(LogicParameter $parameter, private AppConfiguration $config) |
37 | { |
38 | parent::__construct($parameter); |
39 | } |
40 | |
41 | #region ApiLogicBase |
42 | |
43 | protected function validateImpl(LogicCallMode $callMode): void |
44 | { |
45 | //nop |
46 | } |
47 | |
48 | protected function executeImpl(LogicCallMode $callMode): void |
49 | { |
50 | $database = $this->openDatabase(); |
51 | $peSettingEntityDao = new PeSettingEntityDao($database); |
52 | |
53 | $version = $peSettingEntityDao->selectPeSettingVersion(); |
54 | |
55 | $this->redirectUrl = Url::parse( |
56 | Text::replaceMap( |
57 | $this->config->setting->config->address->families->peUpdateInfoUrlBase, |
58 | [ |
59 | 'VERSION' => $version, |
60 | 'UPDATE_INFO_NAME' => 'update.json', |
61 | ] |
62 | ) |
63 | ); |
64 | } |
65 | |
66 | #endregion |
67 | } |