ÿØÿà JFIF ÿÛ „ ( %"1"%)+...383,7(-.-
![]() Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20 System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 User : apache ( 48) PHP Version : 7.4.20 Disable Function : NONE Directory : /proc/self/root/var/www/html/luckymerchan/vendor/brick/money/src/Context/ |
<?php declare(strict_types=1); namespace Brick\Money\Context; use Brick\Money\Context; use Brick\Money\Currency; use Brick\Math\BigDecimal; use Brick\Math\BigNumber; /** * Adjusts a number to the default scale for the currency, respecting a cash rounding. */ final class CashContext implements Context { /** * The cash rounding step, in minor units. * * For example, step 5 on CHF would allow CHF 0.00, CHF 0.05, CHF 0.10, etc. * * @var int */ private $step; /** * @param int $step The cash rounding step, in minor units. Must be a multiple of 2 and/or 5. */ public function __construct(int $step) { $this->step = $step; } /** * {@inheritdoc} */ public function applyTo(BigNumber $amount, Currency $currency, int $roundingMode) : BigDecimal { $scale = $currency->getDefaultFractionDigits(); if ($this->step === 1) { return $amount->toScale($scale, $roundingMode); } return $amount ->toBigRational() ->dividedBy($this->step) ->toScale($scale, $roundingMode) ->multipliedBy($this->step); } /** * {@inheritdoc} */ public function getStep() : int { return $this->step; } /** * {@inheritdoc} */ public function isFixedScale() : bool { return true; } }