Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
14 / 14
100.00% covered (success)
100.00%
3 / 3
CRAP
100.00% covered (success)
100.00%
1 / 1
ApplicationApiVersionUpdateLogic
100.00% covered (success)
100.00%
14 / 14
100.00% covered (success)
100.00%
3 / 3
3
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 validateImpl
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 executeImpl
100.00% covered (success)
100.00%
12 / 12
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace PeServer\App\Models\Domain\Api\ApplicationApi;
6
7use Exception;
8use PeServer\App\Models\AppConfiguration;
9use PeServer\App\Models\AppMailer;
10use PeServer\App\Models\AppTemplate;
11use PeServer\App\Models\AuditLog;
12use PeServer\App\Models\Dao\Entities\FeedbacksEntityDao;
13use PeServer\App\Models\Dao\Entities\PeSettingEntityDao;
14use PeServer\App\Models\Dao\Entities\SequenceEntityDao;
15use PeServer\App\Models\Domain\Api\ApiLogicBase;
16use PeServer\App\Models\ResponseJson;
17use PeServer\Core\Database\IDatabaseContext;
18use PeServer\Core\Mail\Attachment;
19use PeServer\Core\Mail\EmailAddress;
20use PeServer\Core\Mail\EmailMessage;
21use PeServer\Core\Mime;
22use PeServer\Core\Mvc\LogicCallMode;
23use PeServer\Core\Mvc\LogicParameter;
24use PeServer\Core\Text;
25use PeServer\Core\Throws\NotImplementedException;
26use PeServer\Core\Web\Url;
27
28class 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}