Issues (213)

src/cart/ServerRenewPurchase.php (1 issue)

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 SilverFire - Dmitry Naumenko
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