respect-validation/docs/rules/Base.md
Henrique Moody 48405271c5
Replace placeholder "name" with "subject"
The `{{name}}` placeholder could represent different things depending on
the state of the Result, and referring to it as `{{name}}` seems
arbitrary. This commit changes it to `{{subject}}`, which is much more
generic and it describes well what that placeholder can mean.
2025-12-26 21:30:01 +01:00

46 lines
1.2 KiB
Markdown

# Base
- `Base(string $base)`
Validate numbers in any base, even with non regular bases.
```php
v::base(2)->isValid('011010001'); // true
v::base(3)->isValid('0120122001'); // true
v::base(8)->isValid('01234567520'); // true
v::base(16)->isValid('012a34f5675c20d'); // true
v::base(2)->isValid('0120122001'); // false
```
## Templates
### `Base::TEMPLATE_STANDARD`
| Mode | Template |
| ---------- | ---------------------------------------------------------- |
| `default` | {{subject}} must be a number in base {{base|raw}} |
| `inverted` | {{subject}} must not be a number in base {{base|raw}} |
## Template placeholders
| Placeholder | Description |
| ----------- | ---------------------------------------------------------------- |
| `base` | The base passed to the constructor of the rule. |
| `subject` | The validated input or the custom validator name (if specified). |
## Categorization
- Numbers
## Changelog
| Version | Description |
| ------: | ----------- |
| 0.5.0 | Created |
---
See also:
- [Base64](Base64.md)
- [Uuid](Uuid.md)