| Conditions | 3 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | public function prepareData(): array |
||
| 15 | { |
||
| 16 | $refs = parent::prepareData(); |
||
| 17 | if (Yii::$app->user->can('ref.view.not-used')) { |
||
|
|
|||
| 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 | } |
||
| 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.