Zum Inhalt springen

API reference / Quittio \ Core \ View

Formatter

interface in quittio/core

Quittio\Core\View\Formatter · Source

Formats values for display according to a locale.

Methods#

MethodDescription
->date()Formats a date by the conventions of the locale, e.g. "03.10.2026" for locale de.
->money()Formats an amount with two decimals and its currency, e.g. "1.234,50 €" for locale de.
->percent()Formats a percentage such as a VAT rate (BT-152), e.g. "19 %" for locale de.
->price()Prices may have more decimals than amounts; at least two are shown.
->quantity()Formats a quantity with as many decimals as it has, without trailing zeros, e.g. "1,5".

date()#

public function date(Date $date, string $locale): string

Formats a date by the conventions of the locale, e.g. "03.10.2026" for locale de.

ParameterTypeDescription
$dateDate
$localestring
Returns
string

money()#

public function money(Money $money, string $locale): string

Formats an amount with two decimals and its currency, e.g. "1.234,50 €" for locale de.

ParameterTypeDescription
$moneyBrick\Money\Money
$localestring
Returns
string

percent()#

public function percent(BigDecimal $percent, string $locale): string

Formats a percentage such as a VAT rate (BT-152), e.g. "19 %" for locale de.

ParameterTypeDescription
$percentBrick\Math\BigDecimal
$localestring
Returns
string

price()#

public function price(BigDecimal $price, string $currency, string $locale): string

Prices may have more decimals than amounts; at least two are shown.

ParameterTypeDescription
$priceBrick\Math\BigDecimal
$currencystring
$localestring
Returns
string

quantity()#

public function quantity(BigDecimal $quantity, string $locale): string

Formats a quantity with as many decimals as it has, without trailing zeros, e.g. "1,5".

ParameterTypeDescription
$quantityBrick\Math\BigDecimal
$localestring
Returns
string

Die Open-Core-Pakete stehen unter der MIT-Lizenz. Die rechtlichen Formulierungen der Länderpakete sind mit einer Steuerberatung abzustimmen.