📋 Commit iniziale con: - ✅ Documentazione unificata in docs/ - ✅ Codice Laravel in netgescon-laravel/ - ✅ Script automazione in scripts/ - ✅ Configurazione sync rsync - ✅ Struttura organizzata e pulita 🔄 Versione: 2025.07.19-1644 🎯 Sistema pronto per Git distribuito
52 lines
966 B
PHP
52 lines
966 B
PHP
<?php
|
|
|
|
namespace Illuminate\Validation\Rules;
|
|
|
|
use Illuminate\Contracts\Support\Arrayable;
|
|
use Stringable;
|
|
|
|
use function Illuminate\Support\enum_value;
|
|
|
|
class ArrayRule implements Stringable
|
|
{
|
|
/**
|
|
* The accepted keys.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $keys;
|
|
|
|
/**
|
|
* Create a new array rule instance.
|
|
*
|
|
* @param array|null $keys
|
|
*/
|
|
public function __construct($keys = null)
|
|
{
|
|
if ($keys instanceof Arrayable) {
|
|
$keys = $keys->toArray();
|
|
}
|
|
|
|
$this->keys = is_array($keys) ? $keys : func_get_args();
|
|
}
|
|
|
|
/**
|
|
* Convert the rule to a validation string.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function __toString()
|
|
{
|
|
if (empty($this->keys)) {
|
|
return 'array';
|
|
}
|
|
|
|
$keys = array_map(
|
|
static fn ($key) => enum_value($key),
|
|
$this->keys,
|
|
);
|
|
|
|
return 'array:'.implode(',', $keys);
|
|
}
|
|
}
|