| 1 | <?php |
||
| 2 | |||
| 3 | namespace hipanel\modules\server\models; |
||
| 4 | |||
| 5 | use hipanel\base\Model; |
||
| 6 | |||
| 7 | class ConfigPrice extends Model |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * {@inheritdoc} |
||
| 11 | */ |
||
| 12 | public function rules() |
||
| 13 | { |
||
| 14 | return array_merge(parent::rules(), [ |
||
| 15 | [['location', 'currency', 'values', 'value', 'price', 'discounted_price', 'services'], 'string'], |
||
| 16 | [['eur', 'usd'], 'string'], |
||
| 17 | ]); |
||
| 18 | } |
||
| 19 | |||
| 20 | public function getFirstAvailable() |
||
| 21 | { |
||
| 22 | foreach (['eur', 'usd'] as $attribute) { |
||
| 23 | if (!empty($this->values[$attribute])) { |
||
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
| 24 | foreach ($this->values[$attribute] as $field => $value) { |
||
| 25 | $this->{$field} = $value; |
||
| 26 | } |
||
| 27 | break; |
||
| 28 | } |
||
| 29 | } |
||
| 30 | |||
| 31 | return $this; |
||
| 32 | } |
||
| 33 | |||
| 34 | public function getSupportPrice(): ?string |
||
| 35 | { |
||
| 36 | if (!empty($this->services) && isset($this->services['monthly,support_time'])) { |
||
|
0 ignored issues
–
show
The property
services does not exist on hipanel\modules\server\models\ConfigPrice. Since you implemented __get, consider adding a @property annotation.
Loading history...
|
|||
| 37 | return $this->services['monthly,support_time']['price']; |
||
| 38 | } |
||
| 39 | |||
| 40 | return null; |
||
| 41 | } |
||
| 42 | } |
||
| 43 |