ServerRenewPurchase   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
eloc 10
dl 0
loc 29
c 0
b 0
f 0
ccs 0
cts 16
cp 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 6 1
A operation() 0 3 1
A rules() 0 5 1
1
<?php
2
/**
3
 * Server module for HiPanel
4
 *
5
 * @link      https://github.com/hiqdev/hipanel-module-server
6
 * @package   hipanel-module-server
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2019, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hipanel\modules\server\cart;
12
13
use hipanel\base\ModelTrait;
14
15
/**
16
 * Class ServerRenewPurchase.
17
 */
18
class ServerRenewPurchase extends AbstractServerPurchase
19
{
20
    use ModelTrait;
21
22
    /** {@inheritdoc} */
23
    public static function operation()
24
    {
25
        return 'Renew';
26
    }
27
28
    /** {@inheritdoc} */
29
    public function init()
30
    {
31
        parent::init();
32
33
        $this->server = $this->position->name;
0 ignored issues
show
Bug Best Practice introduced by
The property server does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
34
        $this->amount = $this->position->getQuantity();
35
    }
36
37
    /**
38
     * @var string domain expiration datetime
39
     */
40
    public $expires;
41
42
    public function rules()
43
    {
44
        return array_merge(parent::rules(), [
45
            [['server', 'expires'], 'safe'],
46
            [['expires', 'amount'], 'required'],
47
        ]);
48
    }
49
}
50