PHP_INT_MAX - $net || $beforeTax > PHP_INT_MAX - $tax) { throw new \InvalidArgumentException('Base cambial cumulativa inválida.'); } $exchange = new QuotationExchange; $subtotal = $exchange->convert($beforeNet + $net, $rate) - $exchange->convert($beforeNet, $rate); $vat = $exchange->convert($beforeTax + $tax, $rate) - $exchange->convert($beforeTax, $rate); return ['subtotal_minor' => $subtotal, 'tax_minor' => $vat, 'total_minor' => $subtotal + $vat]; } }