API reference / Quittio \ Country \ CH \ QrBill
QrReference
final class in quittio/country-ch
Quittio\Country\CH\QrBill\QrReference · Source
The QR reference of the Swiss QR bill: 27 digits, the last a check digit after modulo 10 recursive (Swiss Implementation Guidelines QR-bill, annex B). It goes with a QR-IBAN only.
Methods#
| Method | Description |
|---|---|
::checkDigit() | The check digit of a string of digits after modulo 10 recursive. |
::format() | The reference in blocks for printing: 2 digits, then blocks of 5. |
::fromDigitsOf() | The QR reference of the digits of $value, e.g. of an invoice number "RE-2026-0042": the digits padded with zeros to 26 and the check digit; null without digits or with more than 26. |
::isValid() | Whether $reference (spaces allowed) is a QR reference with a correct check digit. |
checkDigit()#
public static function checkDigit(string $digits): stringThe check digit of a string of digits after modulo 10 recursive.
| Parameter | Type | Description |
|---|---|---|
$digits | string |
- Returns
string
format()#
public static function format(string $reference): stringThe reference in blocks for printing: 2 digits, then blocks of 5.
| Parameter | Type | Description |
|---|---|---|
$reference | string |
- Returns
string
fromDigitsOf()#
public static function fromDigitsOf(string $value): ?stringThe QR reference of the digits of $value, e.g. of an invoice number "RE-2026-0042": the digits padded with zeros to 26 and the check digit; null without digits or with more than 26.
| Parameter | Type | Description |
|---|---|---|
$value | string |
- Returns
?string
isValid()#
public static function isValid(string $reference): boolWhether $reference (spaces allowed) is a QR reference with a correct check digit.
| Parameter | Type | Description |
|---|---|---|
$reference | string |
- Returns
bool