flexisip-account-manager/flexiapi/app/Rules/Dictionary.php
2024-06-20 09:14:17 +00:00

24 lines
488 B
PHP

<?php
namespace App\Rules;
use Illuminate\Contracts\Validation\Rule;
class Dictionary implements Rule
{
public function passes($attribute, $array): bool
{
if (!is_array($array)) return false;
foreach ($array as $key => $value) {
if (!is_string($key) || !is_string($value)) return false;
}
return true;
}
public function message()
{
return 'The dictionary must be an associative dictionary of strings';
}
}