📋 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
50 lines
1.1 KiB
PHP
50 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Illuminate\Validation\Rules;
|
|
|
|
use Illuminate\Contracts\Support\Arrayable;
|
|
use Stringable;
|
|
|
|
use function Illuminate\Support\enum_value;
|
|
|
|
class Contains implements Stringable
|
|
{
|
|
/**
|
|
* The values that should be contained in the attribute.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $values;
|
|
|
|
/**
|
|
* Create a new contains rule instance.
|
|
*
|
|
* @param \Illuminate\Contracts\Support\Arrayable|\BackedEnum|\UnitEnum|array|string $values
|
|
* @return void
|
|
*/
|
|
public function __construct($values)
|
|
{
|
|
if ($values instanceof Arrayable) {
|
|
$values = $values->toArray();
|
|
}
|
|
|
|
$this->values = is_array($values) ? $values : func_get_args();
|
|
}
|
|
|
|
/**
|
|
* Convert the rule to a validation string.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function __toString()
|
|
{
|
|
$values = array_map(function ($value) {
|
|
$value = enum_value($value);
|
|
|
|
return '"'.str_replace('"', '""', $value).'"';
|
|
}, $this->values);
|
|
|
|
return 'contains:'.implode(',', $values);
|
|
}
|
|
}
|