1 | <?php |
||
2 | |||
3 | namespace hipanel\modules\server\widgets\combo; |
||
4 | |||
5 | use hipanel\modules\server\helpers\ServerHelper; |
||
6 | use hipanel\widgets\RefCombo; |
||
7 | use Yii; |
||
8 | |||
9 | class ServerTypeRefCombo extends RefCombo |
||
10 | { |
||
11 | /** |
||
12 | * @return array |
||
13 | */ |
||
14 | public function prepareData(): array |
||
15 | { |
||
16 | $refs = parent::prepareData(); |
||
17 | if (Yii::$app->user->can('ref.view.not-used')) { |
||
0 ignored issues
–
show
|
|||
18 | return $refs; |
||
19 | } |
||
20 | $usedTypes = ServerHelper::getUsedTypes(); |
||
21 | $allowedTypes = ['dedicated', 'unmanaged', 'setup', 'jbod', 'remote', 'vds', 'avds', 'ovds', 'svds', 'cdn', 'cdnpix', 'nic', 'uplink3']; |
||
22 | if (empty($usedTypes)) { |
||
23 | $usedTypes = $allowedTypes; |
||
24 | } |
||
25 | |||
26 | return array_filter($refs, static function (string $k) use ($usedTypes): bool { |
||
27 | return in_array($k, $usedTypes, true); |
||
28 | }, ARRAY_FILTER_USE_KEY); |
||
29 | } |
||
30 | } |
||
31 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.