Projet
API PHP
Toutes les classes et méthodes publiques de mdgascar/malagasy-intl, module par module. Toutes les classes sont dans l’espace de noms Mdgascar\MalagasyIntl.
Tout se trouve dans l’espace de noms Mdgascar\MalagasyIntl. Les erreurs lèvent MalagasyIntlException ; lisez $exception->errorCode (un ErrorCode), le même code dans tous les langages. Les lieux ont leur propre page : API Lieux.
Nombres en lettres
Section intitulée « Nombres en lettres »| Méthode | Renvoie | Codes d’erreur |
|---|---|---|
NumberWords\NumberWords::spell(int|float|string $n, NumberSystem) |
string |
OUT_OF_RANGE, INVALID_FORMAT |
NumberWords\NumberWords::spellOrdinal(int|string $n, NumberSystem) |
string |
OUT_OF_RANGE, INVALID_FORMAT |
NumberWords\NumberWords::parse(string $words) |
ExactNumber |
INVALID_FORMAT, OUT_OF_RANGE |
NumberWords\NumberWords::safeParse(mixed $words) |
SafeParseResult<ExactNumber> |
jamais |
NumberWords\NumberWords::tryParse(mixed $words) |
?ExactNumber |
jamais |
ExactNumber->value() |
int|float |
PRECISION_LOSS |
ExactNumber->digits |
string |
jamais |
Énumération : NumberWords\NumberSystem (Standard, Traditional).
Téléphone
Section intitulée « Téléphone »| Méthode | Renvoie | Codes d’erreur |
|---|---|---|
PhoneNumber\PhoneNumber::parse(string $input) |
PhoneNumber |
INVALID_FORMAT, UNKNOWN_OPERATOR |
PhoneNumber\PhoneNumber::safeParse(mixed $input) |
SafeParseResult<PhoneNumber> |
jamais |
PhoneNumber\PhoneNumber::tryParse(mixed $input) |
?PhoneNumber |
jamais |
PhoneNumber\PhoneNumber::isValid(mixed $input) |
bool |
jamais |
$phone->format(PhoneNumberFormat $format) |
string |
jamais |
$phone->e164, $phone->nationalNumber |
string |
jamais |
$phone->operator |
Operator |
jamais |
$phone->type |
PhoneLineType |
jamais |
$phone->area |
?PhoneArea (name, province) |
jamais |
Énumérations : PhoneNumberFormat (E164, International, National), Operator (displayName()), PhoneLineType (Mobile, Fixed).
| Méthode | Renvoie | Codes d’erreur |
|---|---|---|
Ariary\Ariary::fromInt(int $amount) |
Ariary |
OUT_OF_RANGE |
Ariary\Ariary::fromFloat(float $amount) |
Ariary |
OUT_OF_RANGE, INVALID_TYPE |
Ariary\Ariary::fromText(string $amount) |
Ariary |
INVALID_FORMAT |
Ariary\Ariary::parse(string $text, ?Grouping, DecimalSeparator) |
Ariary |
INVALID_FORMAT, INVALID_TYPE |
Ariary\Ariary::safeParse(mixed $text, …) |
SafeParseResult<Ariary> |
jamais |
Ariary\Ariary::tryParse(mixed $text, …) |
?Ariary |
jamais |
Ariary\Ariary::fromFmg(int|float|string $francs) |
Ariary |
OUT_OF_RANGE, INVALID_FORMAT |
Ariary\Ariary::formatFmg(int|float|string $francs, …) |
string |
OUT_OF_RANGE, INVALID_FORMAT |
$amount->format(Grouping, SymbolPosition, DecimalSeparator) |
string |
INVALID_TYPE |
$amount->spell(NumberSystem) |
string |
jamais |
$amount->amount() |
int|float |
PRECISION_LOSS |
$amount->digits |
string |
jamais |
$amount->toFmg() |
int|float |
PRECISION_LOSS |
$amount->toFmgDigits() |
string |
jamais |
Énumérations : Grouping (Space, Dot, Comma), DecimalSeparator (Comma, Dot), SymbolPosition (Before, After).
| Méthode | Renvoie | Codes d’erreur |
|---|---|---|
DateTime\MalagasyDate::fromString(string $isoDate) |
MalagasyDate |
INVALID_FORMAT, OUT_OF_RANGE |
DateTime\MalagasyDate::fromParts(int $year, int $month, int $day) |
MalagasyDate |
OUT_OF_RANGE |
DateTime\MalagasyDate::fromDateTime(DateTimeInterface $date) |
MalagasyDate |
OUT_OF_RANGE |
DateTime\MalagasyDate::parse(string $text, ?DateStyle) |
MalagasyDate |
INVALID_FORMAT, OUT_OF_RANGE |
DateTime\MalagasyDate::safeParse(mixed $text, ?DateStyle) |
SafeParseResult<MalagasyDate> |
jamais |
DateTime\MalagasyDate::tryParse(mixed $text, ?DateStyle) |
?MalagasyDate |
jamais |
DateTime\MalagasyDateTime::fromString(string $dateTime) |
MalagasyDateTime |
INVALID_FORMAT, OUT_OF_RANGE |
$dateTime->spell(DateStyle $style) |
string |
jamais |
$date->format(DateStyle $style) |
string |
jamais |
DateTime\MalagasyDate::monthName(int $month, NameWidth) |
string |
OUT_OF_RANGE |
DateTime\MalagasyDate::weekdayName(int $isoWeekday, NameWidth) |
string |
OUT_OF_RANGE |
Énumérations : DateStyle (Long, Full, Medium, Short, Numeric), NameWidth (Wide, Abbreviated).
$date->isoWeekday() renvoie le jour de la semaine au format ISO (lundi 1, dimanche 7).
Éléments communs
Section intitulée « Éléments communs »| Classe | Rôle |
|---|---|
MalagasyIntlException |
Levée quand une entrée est refusée ; ->errorCode est un ErrorCode |
ErrorCode |
InvalidType, OutOfRange, InvalidFormat, UnknownOperator, PrecisionLoss |
SafeParseResult |
->success, ->data et ->error, renvoyés par chaque safeParse() |
ExactNumber |
Un nombre lu dans un texte : ->digits, et value() quand un entier ou un flottant peut le contenir exactement |
SpecVersion::VERSION |
La version de la spécification que ce paquet implémente |
Un argument du mauvais type provoque la TypeError native de PHP, que la spécification désigne par INVALID_TYPE.