Code Duplication    Length = 24-24 lines in 2 locations

src/models/decorators/server/HddResourceDecorator.php 1 location

@@ 7-30 (lines=24) @@
4
5
use Yii;
6
7
class HddResourceDecorator extends AbstractServerResourceDecorator
8
{
9
    public function displayTitle()
10
    {
11
        return Yii::t('hipanel/server/order', 'SSD');
12
    }
13
14
    public function displayValue()
15
    {
16
        $part = $this->resource->part;
17
        preg_match('/((\d{1,5}) GB)$/i', $part->partno, $matches);
18
        return Yii::t('yii', '{nFormatted} GB', ['nFormatted' => (int) $matches[2]]); // Gb
19
    }
20
21
    public function getOverusePrice()
22
    {
23
        return 0.2; // TODO: move to config
24
    }
25
26
    public function displayUnit()
27
    {
28
        return Yii::t('yii', '{nFormatted} GB', ['nFormatted' => 1]);
29
    }
30
}
31

src/models/decorators/server/RamResourceDecorator.php 1 location

@@ 7-30 (lines=24) @@
4
5
use Yii;
6
7
class RamResourceDecorator extends AbstractServerResourceDecorator
8
{
9
    public function displayTitle()
10
    {
11
        return Yii::t('hipanel/server/order', 'RAM');
12
    }
13
14
    public function displayValue()
15
    {
16
        $part = $this->resource->part;
17
        preg_match('/((\d{1,5}) MB)$/i', $part->partno, $matches);
18
        return Yii::t('yii', '{nFormatted} GB', ['nFormatted' => (int) $matches[2] / 1024]); // Gb
19
    }
20
21
    public function getOverusePrice()
22
    {
23
        return 4; // TODO: move to config
24
    }
25
26
    public function displayUnit()
27
    {
28
        return Yii::t('yii', '{nFormatted} GB', ['nFormatted' => 1]);
29
    }
30
}
31