mirror of
https://github.com/Respect/Validation.git
synced 2026-03-17 15:50:03 +01:00
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.
46 lines
1.2 KiB
Markdown
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)
|