| 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 hipanel\modules\finance\models\RUse; |
||
| 14 | |||
| 15 | class ServerUse extends RUse |
||
| 16 | { |
||
| 17 | use \hipanel\base\ModelTrait; |
||
| 18 | |||
| 19 | public function formName() |
||
| 20 | { |
||
| 21 | return 'ServerUse'; |
||
| 22 | } |
||
| 23 | |||
| 24 | public static function tableName() |
||
| 25 | { |
||
| 26 | return 'server'; |
||
| 27 | } |
||
| 28 | |||
| 29 | private function getTrafficTypes() |
||
| 30 | { |
||
| 31 | return ['server_traf_in', 'server_traf_max', 'server_traf']; |
||
| 32 | } |
||
| 33 | |||
| 34 | private function getBandwidthTypes() |
||
| 35 | { |
||
| 36 | return ['server_traf95_in', 'server_traf95_max', 'server_traf95']; |
||
| 37 | } |
||
| 38 | |||
| 39 | public function getDisplayAmount() |
||
| 40 | { |
||
| 41 | if (in_array($this->type, $this->getBandwidthTypes(), true)) { |
||
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
| 42 | return round($this->last / pow(10, 6), 2); |
||
|
0 ignored issues
–
show
The property
last does not exist on hipanel\modules\server\models\ServerUse. Since you implemented __get, consider adding a @property annotation.
Loading history...
|
|||
| 43 | } elseif (in_array($this->type, $this->getTrafficTypes(), true)) { |
||
| 44 | return round($this->total / pow(10, 9), 2); |
||
|
0 ignored issues
–
show
The property
total does not exist on hipanel\modules\server\models\ServerUse. Since you implemented __get, consider adding a @property annotation.
Loading history...
|
|||
| 45 | } |
||
| 46 | |||
| 47 | return $this->total; |
||
| 48 | } |
||
| 49 | } |
||
| 50 |