10000 ) { throw new \InvalidArgumentException( 'Taux de TVA hors limites : ' . $text ); // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped -- message technique, jamais affiché. } return $hundredths; } public static function isAllowed( int $hundredths ): bool { return in_array( $hundredths, self::ALLOWED, true ); } /** 550 → « 5.50 » (format attendu par l'API de la plateforme). */ public static function toDecimalString( int $hundredths ): string { return sprintf( '%d.%02d', intdiv( $hundredths, 100 ), $hundredths % 100 ); } /** 550 → « 5,5 % » (affichage). */ public static function label( int $hundredths ): string { $text = rtrim( rtrim( self::toDecimalString( $hundredths ), '0' ), '.' ); return str_replace( '.', ',', $text ) . ' %'; } }