Code Duplication    Length = 14-14 lines in 2 locations

src/cart/ServerRenewProduct.php 1 location

@@ 71-84 (lines=14) @@
68
    }
69
70
    /** {@inheritdoc} */
71
    public function getQuantityOptions()
72
    {
73
        $result = [];
74
        foreach ([1, 3, 6, 12] as $n) {
75
            $date = (new DateTime($this->_model->expires))->add(new \DateInterval("P{$n}M"));
76
77
            $result[$n] = Yii::t('hipanel:server', '{n, plural, one{# month} other{# months}} till {date}', [
78
                'n' => $n,
79
                'date' => Yii::$app->formatter->asDate($date),
80
            ]);
81
        }
82
83
        return $result;
84
    }
85
86
    /** {@inheritdoc} */
87
    public function getPurchaseModel($options = [])

src/cart/AbstractServerProduct.php 1 location

@@ 35-48 (lines=14) @@
32
    }
33
34
    /** {@inheritdoc} */
35
    public function getQuantityOptions()
36
    {
37
        $result = [];
38
        foreach ([1, 3, 6, 12] as $n) {
39
            $date = (new DateTime())->add(new \DateInterval("P{$n}M"));
40
41
            $result[$n] = Yii::t('hipanel:server', '{n, plural, one{# month} other{# months}} till {date}', [
42
                'n' => $n,
43
                'date' => Yii::$app->formatter->asDate($date),
44
            ]);
45
        }
46
47
        return $result;
48
    }
49
50
    /**
51
     * {@inheritdoc}