OpenvzPackage   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 7
c 1
b 0
f 0
dl 0
loc 22
ccs 0
cts 14
cp 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getResourceValue_cpu() 0 6 1
A getResourceTitle_hdd() 0 3 1
A getLocations() 0 6 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\models;
12
13
use Yii;
14
15
/**
16
 * Class OpenvzPackage.
17
 * @property string $name
18
 */
19
class OpenvzPackage extends Package
20
{
21
    protected function getResourceValue_cpu()
22
    {
23
        $part = $this->getPartByType('cpu');
0 ignored issues
show
Bug introduced by
The method getPartByType() does not exist on hipanel\modules\server\models\OpenvzPackage. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

23
        /** @scrutinizer ignore-call */ 
24
        $part = $this->getPartByType('cpu');
Loading history...
24
        preg_match('/((\d+) MHz)$/i', $part->partno, $matches);
25
26
        return Yii::t('hipanel:server', '{0, number} MHz', $matches[2]);
27
    }
28
29
    protected function getResourceTitle_hdd()
30
    {
31
        return Yii::t('hipanel:server', 'HDD + SSD cache');
32
    }
33
34
    /** {@inheritdoc} */
35
    public function getLocations()
36
    {
37
        return [
38
            // RED ask
39
//            3 => Yii::t('hipanel:server', 'Netherlands, Amsterdam'),
40
            2 => Yii::t('hipanel:server', 'USA, Ashburn'),
41
        ];
42
    }
43
}
44