mirror of
https://github.com/pterodactyl/panel.git
synced 2026-11-30 11:25:52 -05:00
Co-authored-by: Anthony <anthony@infraly.co> Co-authored-by: Sky Mulley <daniel.mulley@outlook.com>
26 lines
530 B
PHP
26 lines
530 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Pterodactyl\Support;
|
|
|
|
final class ValidationRuleSubset
|
|
{
|
|
/**
|
|
* @param NormalizedValidationRules $rules
|
|
* @param list<string> $keys
|
|
* @return NormalizedValidationRules
|
|
*/
|
|
public static function select(array $rules, array $keys): array
|
|
{
|
|
$selected = [];
|
|
foreach ($keys as $key) {
|
|
if (array_key_exists($key, $rules)) {
|
|
$selected[$key] = $rules[$key];
|
|
}
|
|
}
|
|
|
|
return $selected;
|
|
}
|
|
}
|