squareetlabs /
LaravelToon
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace Squareetlabs\LaravelToon\Rules; |
||
| 6 | |||
| 7 | use Illuminate\Contracts\Validation\Rule; |
||
| 8 | use Squareetlabs\LaravelToon\Services\ToonService; |
||
| 9 | |||
| 10 | class ValidToonFormat implements Rule |
||
|
0 ignored issues
–
show
|
|||
| 11 | { |
||
| 12 | public function __construct( |
||
| 13 | private readonly ToonService $toon = new ToonService(), |
||
| 14 | ) {} |
||
| 15 | |||
| 16 | public function passes($attribute, $value): bool |
||
| 17 | { |
||
| 18 | try { |
||
| 19 | $this->toon->decode((string)$value); |
||
| 20 | |||
| 21 | return true; |
||
| 22 | } catch (\Exception) { |
||
| 23 | return false; |
||
| 24 | } |
||
| 25 | } |
||
| 26 | |||
| 27 | public function message(): string |
||
| 28 | { |
||
| 29 | return 'El valor no es un formato TOON válido.'; |
||
| 30 | } |
||
| 31 | } |
||
| 32 | |||
| 33 |
This interface has been deprecated. The supplier of the interface has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the interface will be removed and what other interface to use instead.