src/Services/Fx/FxSafetyBufferPolicy.php line 142

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Services\Fx;
  4. use App\Entity\FxPolicyAudit;
  5. use Doctrine\ORM\EntityManagerInterface;
  6. /**
  7. * Global FX safety policy: MARKET_MINUS_PERCENT.
  8. *
  9. * Adjusted rate = reference rate × (1 − percent/100).
  10. * Default 5% → multiplier 0.95. Applied exactly once; never to same-currency 1:1.
  11. */
  12. class FxSafetyBufferPolicy
  13. {
  14. public const POLICY_MARKET_MINUS_PERCENT = 'MARKET_MINUS_PERCENT';
  15. private string $defaultPercent;
  16. private ?EntityManagerInterface $entityManager;
  17. /**
  18. * @param int|float|string $bufferPercent Percent points, e.g. 5 for 5%.
  19. */
  20. public function __construct($bufferPercent = 5, ?EntityManagerInterface $entityManager = null)
  21. {
  22. $this->defaultPercent = $this->normalizePercent($bufferPercent);
  23. $this->entityManager = $entityManager;
  24. }
  25. public function getPolicyName(): string
  26. {
  27. return self::POLICY_MARKET_MINUS_PERCENT;
  28. }
  29. public function getBufferPercent(): string
  30. {
  31. $override = $this->latestOverridePercent();
  32. return $override ?? $this->defaultPercent;
  33. }
  34. public function getConfiguredDefaultPercent(): string
  35. {
  36. return $this->defaultPercent;
  37. }
  38. /**
  39. * Multiplier applied to the reference rate (0.95 when buffer is 5%).
  40. */
  41. public function getMultiplier(): string
  42. {
  43. return bcsub('1', bcdiv($this->getBufferPercent(), '100', 12), 12);
  44. }
  45. /**
  46. * Markup as a decimal fraction for FxConversion.markup (0.05 when buffer is 5%).
  47. */
  48. public function getMarkupFraction(): string
  49. {
  50. return bcdiv($this->getBufferPercent(), '100', 8);
  51. }
  52. /**
  53. * Apply the safety buffer to a reference/market rate exactly once.
  54. * Do not pass an already-adjusted rate.
  55. */
  56. public function adjustReferenceRate(string $referenceRate): string
  57. {
  58. $referenceRate = trim($referenceRate);
  59. if ($referenceRate === '' || !is_numeric($referenceRate) || stripos($referenceRate, 'e') !== false) {
  60. throw new \InvalidArgumentException(sprintf('Invalid reference rate: "%s"', $referenceRate));
  61. }
  62. if (bccomp($referenceRate, '0', 12) <= 0) {
  63. throw new \InvalidArgumentException('Reference rate must be greater than zero');
  64. }
  65. if (bccomp($this->getBufferPercent(), '0', 4) === 0) {
  66. return $referenceRate;
  67. }
  68. return bcmul($referenceRate, $this->getMultiplier(), 12);
  69. }
  70. public function withBufferPercent($bufferPercent): self
  71. {
  72. return new self($bufferPercent, $this->entityManager);
  73. }
  74. /**
  75. * @return array{
  76. * policy: string,
  77. * safety_buffer_percent: string,
  78. * configured_default_percent: string,
  79. * multiplier: string,
  80. * calculation: string
  81. * }
  82. */
  83. public function describe(): array
  84. {
  85. $multiplier = $this->getMultiplier();
  86. return [
  87. 'policy' => self::POLICY_MARKET_MINUS_PERCENT,
  88. 'safety_buffer_percent' => $this->getBufferPercent(),
  89. 'configured_default_percent' => $this->defaultPercent,
  90. 'multiplier' => $multiplier,
  91. 'calculation' => sprintf(
  92. 'Reference Rate × %s%%',
  93. rtrim(rtrim(bcmul($multiplier, '100', 4), '0'), '.')
  94. ),
  95. ];
  96. }
  97. private function latestOverridePercent(): ?string
  98. {
  99. if ($this->entityManager === null) {
  100. return null;
  101. }
  102. try {
  103. $latest = $this->entityManager->getRepository(FxPolicyAudit::class)->findOneBy([], ['id' => 'DESC']);
  104. } catch (\Throwable $e) {
  105. return null;
  106. }
  107. if (!$latest instanceof FxPolicyAudit) {
  108. return null;
  109. }
  110. return $this->normalizePercent($latest->getToPercent());
  111. }
  112. /**
  113. * @param int|float|string $value
  114. */
  115. private function normalizePercent($value): string
  116. {
  117. $raw = trim((string) $value);
  118. if ($raw === '' || !is_numeric($raw) || stripos($raw, 'e') !== false) {
  119. throw new \InvalidArgumentException(sprintf('Invalid FX safety buffer percent: "%s"', $raw));
  120. }
  121. $normalized = bcadd($raw, '0', 4);
  122. if (bccomp($normalized, '0', 4) < 0 || bccomp($normalized, '50', 4) > 0) {
  123. throw new \InvalidArgumentException('FX safety buffer percent must be between 0 and 50');
  124. }
  125. return $normalized;
  126. }
  127. }
Attempted to call function "bcadd" from namespace "App\Services\Fx". (500 Internal Server Error)

Symfony Exception

UndefinedFunctionError

HTTP 500 Internal Server Error

Attempted to call function "bcadd" from namespace "App\Services\Fx".

Exception

Symfony\Component\ErrorHandler\Error\ UndefinedFunctionError

  1.     {
  2.         $raw trim((string) $value);
  3.         if ($raw === '' || !is_numeric($raw) || stripos($raw'e') !== false) {
  4.             throw new \InvalidArgumentException(sprintf('Invalid FX safety buffer percent: "%s"'$raw));
  5.         }
  6.         $normalized bcadd($raw'0'4);
  7.         if (bccomp($normalized'0'4) < || bccomp($normalized'50'4) > 0) {
  8.             throw new \InvalidArgumentException('FX safety buffer percent must be between 0 and 50');
  9.         }
  10.         return $normalized;
FxSafetyBufferPolicy->normalizePercent() in src/Services/Fx/FxSafetyBufferPolicy.php (line 28)
  1.     /**
  2.      * @param int|float|string $bufferPercent Percent points, e.g. 5 for 5%.
  3.      */
  4.     public function __construct($bufferPercent 5, ?EntityManagerInterface $entityManager null)
  5.     {
  6.         $this->defaultPercent $this->normalizePercent($bufferPercent);
  7.         $this->entityManager $entityManager;
  8.     }
  9.     public function getPolicyName(): string
  10.     {
  1.         if (isset($this->services['App\\Services\\Fx\\FxSafetyBufferPolicy'])) {
  2.             return $this->services['App\\Services\\Fx\\FxSafetyBufferPolicy'];
  3.         }
  4.         return $this->services['App\\Services\\Fx\\FxSafetyBufferPolicy'] = new \App\Services\Fx\FxSafetyBufferPolicy($this->getEnv('int:FX_SAFETY_BUFFER_PERCENT'), $a);
  5.     }
  6.     /**
  7.      * Gets the public 'App\Services\Fx\FxService' shared autowired service.
  8.      *
in var/cache/dev/ContainerSxeEifr/App_KernelDevDebugContainer.php -> getFxSafetyBufferPolicyService (line 10698)
  1.         $b = ($this->services['App\\Services\\Fx\\DatabaseFxRateProvider'] ?? $this->getDatabaseFxRateProviderService());
  2.         if (isset($this->services['App\\Services\\Fx\\FxService'])) {
  3.             return $this->services['App\\Services\\Fx\\FxService'];
  4.         }
  5.         $c = ($this->services['App\\Services\\Fx\\FxSafetyBufferPolicy'] ?? $this->getFxSafetyBufferPolicyService());
  6.         if (isset($this->services['App\\Services\\Fx\\FxService'])) {
  7.             return $this->services['App\\Services\\Fx\\FxService'];
  8.         }
  1.      */
  2.     protected function getPaymentFxServiceService()
  3.     {
  4.         include_once \dirname(__DIR__4).'/src/Services/Currency/PaymentFxService.php';
  5.         $a = ($this->services['App\\Services\\Fx\\FxService'] ?? $this->getFxServiceService());
  6.         if (isset($this->services['App\\Services\\Currency\\PaymentFxService'])) {
  7.             return $this->services['App\\Services\\Currency\\PaymentFxService'];
  8.         }
  9.         $b = ($this->services['App\\Services\\Currency\\LedgerCurrencyService'] ?? $this->getLedgerCurrencyServiceService());
in var/cache/dev/ContainerSxeEifr/App_KernelDevDebugContainer.php -> getPaymentFxServiceService (line 11449)
  1.         $a = ($this->services['doctrine.orm.default_entity_manager'] ?? $this->getDoctrine_Orm_DefaultEntityManagerService());
  2.         if (isset($this->services['App\\Services\\Integration\\Payadmit\\PayadmitIntegrationService'])) {
  3.             return $this->services['App\\Services\\Integration\\Payadmit\\PayadmitIntegrationService'];
  4.         }
  5.         $b = ($this->services['App\\Services\\Currency\\PaymentFxService'] ?? $this->getPaymentFxServiceService());
  6.         if (isset($this->services['App\\Services\\Integration\\Payadmit\\PayadmitIntegrationService'])) {
  7.             return $this->services['App\\Services\\Integration\\Payadmit\\PayadmitIntegrationService'];
  8.         }
  9.         $c = ($this->services['App\\Services\\Currency\\LedgerCurrencyService'] ?? $this->getLedgerCurrencyServiceService());
in var/cache/dev/ContainerSxeEifr/App_KernelDevDebugContainer.php -> getPayadmitIntegrationServiceService (line 7232)
  1.     protected function getPayadmitWebhookTerminateSubscriberService()
  2.     {
  3.         include_once \dirname(__DIR__4).'/src/EventSubscriber/PayadmitWebhookTerminateSubscriber.php';
  4.         include_once \dirname(__DIR__4).'/src/Services/Integration/Payadmit/PayadmitAsyncWebhookBuffer.php';
  5.         $a = ($this->services['App\\Services\\Integration\\Payadmit\\PayadmitIntegrationService'] ?? $this->getPayadmitIntegrationServiceService());
  6.         if (isset($this->services['App\\EventSubscriber\\PayadmitWebhookTerminateSubscriber'])) {
  7.             return $this->services['App\\EventSubscriber\\PayadmitWebhookTerminateSubscriber'];
  8.         }
in var/cache/dev/ContainerSxeEifr/App_KernelDevDebugContainer.php -> getPayadmitWebhookTerminateSubscriberService (line 15422)
  1.         }, => 'onKernelRequest'], 5);
  2.         $instance->addListener('Symfony\\Component\\Security\\Http\\Event\\LogoutEvent', [=> function () {
  3.             return ($this->services['App\\EventSubscriber\\LogoutSubscriber'] ?? $this->getLogoutSubscriberService());
  4.         }, => 'onLogoutEvent'], 0);
  5.         $instance->addListener('kernel.terminate', [=> function () {
  6.             return ($this->services['App\\EventSubscriber\\PayadmitWebhookTerminateSubscriber'] ?? $this->getPayadmitWebhookTerminateSubscriberService());
  7.         }, => 'onKernelTerminate'], 0);
  8.         $instance->addListener('kernel.response', [=> function () {
  9.             return ($this->services['App\\EventSubscriber\\SessionCookieDedupSubscriber'] ?? ($this->services['App\\EventSubscriber\\SessionCookieDedupSubscriber'] = new \App\EventSubscriber\SessionCookieDedupSubscriber()));
  10.         }, => 'onKernelResponse'], -1010);
  11.         $instance->addListener('kernel.request', [=> function () {
in vendor/symfony/event-dispatcher/EventDispatcher.php -> ContainerSxeEifr\{closure} (line 245)
  1.         $this->sorted[$eventName] = [];
  2.         foreach ($this->listeners[$eventName] as &$listeners) {
  3.             foreach ($listeners as $k => &$listener) {
  4.                 if (\is_array($listener) && isset($listener[0]) && $listener[0] instanceof \Closure && >= \count($listener)) {
  5.                     $listener[0] = $listener[0]();
  6.                     $listener[1] = $listener[1] ?? '__invoke';
  7.                 }
  8.                 $this->sorted[$eventName][] = $listener;
  9.             }
  10.         }
  1.             if (empty($this->listeners[$eventName])) {
  2.                 return [];
  3.             }
  4.             if (!isset($this->sorted[$eventName])) {
  5.                 $this->sortListeners($eventName);
  6.             }
  7.             return $this->sorted[$eventName];
  8.         }
  1.             $this->orphanedEvents[$this->currentRequestHash][] = $eventName;
  2.             return;
  3.         }
  4.         foreach ($this->dispatcher->getListeners($eventName) as $listener) {
  5.             $priority $this->getListenerPriority($eventName$listener);
  6.             $wrappedListener = new WrappedListener($listener instanceof WrappedListener $listener->getWrappedListener() : $listenernull$this->stopwatch$this);
  7.             $this->wrappedListeners[$eventName][] = $wrappedListener;
  8.             $this->dispatcher->removeListener($eventName$listener);
  9.             $this->dispatcher->addListener($eventName$wrappedListener$priority);
  1.         if (null !== $this->logger && $event instanceof StoppableEventInterface && $event->isPropagationStopped()) {
  2.             $this->logger->debug(sprintf('The "%s" event is already stopped. No listeners have been called.'$eventName));
  3.         }
  4.         $this->preProcess($eventName);
  5.         try {
  6.             $this->beforeDispatch($eventName$event);
  7.             try {
  8.                 $e $this->stopwatch->start($eventName'section');
  9.                 try {
  1.     /**
  2.      * {@inheritdoc}
  3.      */
  4.     public function terminate(Request $requestResponse $response)
  5.     {
  6.         $this->dispatcher->dispatch(new TerminateEvent($this$request$response), KernelEvents::TERMINATE);
  7.     }
  8.     /**
  9.      * @internal
  10.      */
in vendor/symfony/http-kernel/Kernel.php -> terminate (line 159)
  1.         if (false === $this->booted) {
  2.             return;
  3.         }
  4.         if ($this->getHttpKernel() instanceof TerminableInterface) {
  5.             $this->getHttpKernel()->terminate($request$response);
  6.         }
  7.     }
  8.     /**
  9.      * {@inheritdoc}
Kernel->terminate() in public/index.php (line 31)
  1. $kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
  2. $request Request::createFromGlobals();
  3. $response $kernel->handle($request);
  4. $response->send();
  5. $kernel->terminate($request$response);

Logs

No log messages

Stack Trace

UndefinedFunctionError
Symfony\Component\ErrorHandler\Error\UndefinedFunctionError:
Attempted to call function "bcadd" from namespace "App\Services\Fx".

  at src/Services/Fx/FxSafetyBufferPolicy.php:142
  at App\Services\Fx\FxSafetyBufferPolicy->normalizePercent()
     (src/Services/Fx/FxSafetyBufferPolicy.php:28)
  at App\Services\Fx\FxSafetyBufferPolicy->__construct()
     (var/cache/dev/ContainerSxeEifr/App_KernelDevDebugContainer.php:10676)
  at ContainerSxeEifr\App_KernelDevDebugContainer->getFxSafetyBufferPolicyService()
     (var/cache/dev/ContainerSxeEifr/App_KernelDevDebugContainer.php:10698)
  at ContainerSxeEifr\App_KernelDevDebugContainer->getFxServiceService()
     (var/cache/dev/ContainerSxeEifr/App_KernelDevDebugContainer.php:10491)
  at ContainerSxeEifr\App_KernelDevDebugContainer->getPaymentFxServiceService()
     (var/cache/dev/ContainerSxeEifr/App_KernelDevDebugContainer.php:11449)
  at ContainerSxeEifr\App_KernelDevDebugContainer->getPayadmitIntegrationServiceService()
     (var/cache/dev/ContainerSxeEifr/App_KernelDevDebugContainer.php:7232)
  at ContainerSxeEifr\App_KernelDevDebugContainer->getPayadmitWebhookTerminateSubscriberService()
     (var/cache/dev/ContainerSxeEifr/App_KernelDevDebugContainer.php:15422)
  at ContainerSxeEifr\App_KernelDevDebugContainer->ContainerSxeEifr\{closure}()
     (vendor/symfony/event-dispatcher/EventDispatcher.php:245)
  at Symfony\Component\EventDispatcher\EventDispatcher->sortListeners()
     (vendor/symfony/event-dispatcher/EventDispatcher.php:76)
  at Symfony\Component\EventDispatcher\EventDispatcher->getListeners()
     (vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:293)
  at Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher->preProcess()
     (vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:148)
  at Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher->dispatch()
     (vendor/symfony/http-kernel/HttpKernel.php:97)
  at Symfony\Component\HttpKernel\HttpKernel->terminate()
     (vendor/symfony/http-kernel/Kernel.php:159)
  at Symfony\Component\HttpKernel\Kernel->terminate()
     (public/index.php:31)                
Attempted to call function "bcadd" from namespace "App\Services\Fx". (500 Internal Server Error)

Symfony Exception

UndefinedFunctionError

HTTP 500 Internal Server Error

Attempted to call function "bcadd" from namespace "App\Services\Fx".

Exception

Symfony\Component\ErrorHandler\Error\ UndefinedFunctionError

  1.     {
  2.         $raw trim((string) $value);
  3.         if ($raw === '' || !is_numeric($raw) || stripos($raw'e') !== false) {
  4.             throw new \InvalidArgumentException(sprintf('Invalid FX safety buffer percent: "%s"'$raw));
  5.         }
  6.         $normalized bcadd($raw'0'4);
  7.         if (bccomp($normalized'0'4) < || bccomp($normalized'50'4) > 0) {
  8.             throw new \InvalidArgumentException('FX safety buffer percent must be between 0 and 50');
  9.         }
  10.         return $normalized;
FxSafetyBufferPolicy->normalizePercent() in /var/www/betbit-new/app/src/Services/Fx/FxSafetyBufferPolicy.php (line 28)
  1.     /**
  2.      * @param int|float|string $bufferPercent Percent points, e.g. 5 for 5%.
  3.      */
  4.     public function __construct($bufferPercent 5, ?EntityManagerInterface $entityManager null)
  5.     {
  6.         $this->defaultPercent $this->normalizePercent($bufferPercent);
  7.         $this->entityManager $entityManager;
  8.     }
  9.     public function getPolicyName(): string
  10.     {
  1.         if (isset($this->services['App\\Services\\Fx\\FxSafetyBufferPolicy'])) {
  2.             return $this->services['App\\Services\\Fx\\FxSafetyBufferPolicy'];
  3.         }
  4.         return $this->services['App\\Services\\Fx\\FxSafetyBufferPolicy'] = new \App\Services\Fx\FxSafetyBufferPolicy($this->getEnv('int:FX_SAFETY_BUFFER_PERCENT'), $a);
  5.     }
  6.     /**
  7.      * Gets the public 'App\Services\Fx\FxService' shared autowired service.
  8.      *
  1.         $b = ($this->services['App\\Services\\Fx\\DatabaseFxRateProvider'] ?? $this->getDatabaseFxRateProviderService());
  2.         if (isset($this->services['App\\Services\\Fx\\FxService'])) {
  3.             return $this->services['App\\Services\\Fx\\FxService'];
  4.         }
  5.         $c = ($this->services['App\\Services\\Fx\\FxSafetyBufferPolicy'] ?? $this->getFxSafetyBufferPolicyService());
  6.         if (isset($this->services['App\\Services\\Fx\\FxService'])) {
  7.             return $this->services['App\\Services\\Fx\\FxService'];
  8.         }
  1.      */
  2.     protected function getPaymentFxServiceService()
  3.     {
  4.         include_once \dirname(__DIR__4).'/src/Services/Currency/PaymentFxService.php';
  5.         $a = ($this->services['App\\Services\\Fx\\FxService'] ?? $this->getFxServiceService());
  6.         if (isset($this->services['App\\Services\\Currency\\PaymentFxService'])) {
  7.             return $this->services['App\\Services\\Currency\\PaymentFxService'];
  8.         }
  9.         $b = ($this->services['App\\Services\\Currency\\LedgerCurrencyService'] ?? $this->getLedgerCurrencyServiceService());
  1.         $a = ($this->services['doctrine.orm.default_entity_manager'] ?? $this->getDoctrine_Orm_DefaultEntityManagerService());
  2.         if (isset($this->services['App\\Services\\Integration\\Payadmit\\PayadmitIntegrationService'])) {
  3.             return $this->services['App\\Services\\Integration\\Payadmit\\PayadmitIntegrationService'];
  4.         }
  5.         $b = ($this->services['App\\Services\\Currency\\PaymentFxService'] ?? $this->getPaymentFxServiceService());
  6.         if (isset($this->services['App\\Services\\Integration\\Payadmit\\PayadmitIntegrationService'])) {
  7.             return $this->services['App\\Services\\Integration\\Payadmit\\PayadmitIntegrationService'];
  8.         }
  9.         $c = ($this->services['App\\Services\\Currency\\LedgerCurrencyService'] ?? $this->getLedgerCurrencyServiceService());
  1.     protected function getPayadmitWebhookTerminateSubscriberService()
  2.     {
  3.         include_once \dirname(__DIR__4).'/src/EventSubscriber/PayadmitWebhookTerminateSubscriber.php';
  4.         include_once \dirname(__DIR__4).'/src/Services/Integration/Payadmit/PayadmitAsyncWebhookBuffer.php';
  5.         $a = ($this->services['App\\Services\\Integration\\Payadmit\\PayadmitIntegrationService'] ?? $this->getPayadmitIntegrationServiceService());
  6.         if (isset($this->services['App\\EventSubscriber\\PayadmitWebhookTerminateSubscriber'])) {
  7.             return $this->services['App\\EventSubscriber\\PayadmitWebhookTerminateSubscriber'];
  8.         }
in /var/www/betbit-new/app/var/cache/dev/ContainerSxeEifr/App_KernelDevDebugContainer.php -> getPayadmitWebhookTerminateSubscriberService (line 15422)
  1.         }, => 'onKernelRequest'], 5);
  2.         $instance->addListener('Symfony\\Component\\Security\\Http\\Event\\LogoutEvent', [=> function () {
  3.             return ($this->services['App\\EventSubscriber\\LogoutSubscriber'] ?? $this->getLogoutSubscriberService());
  4.         }, => 'onLogoutEvent'], 0);
  5.         $instance->addListener('kernel.terminate', [=> function () {
  6.             return ($this->services['App\\EventSubscriber\\PayadmitWebhookTerminateSubscriber'] ?? $this->getPayadmitWebhookTerminateSubscriberService());
  7.         }, => 'onKernelTerminate'], 0);
  8.         $instance->addListener('kernel.response', [=> function () {
  9.             return ($this->services['App\\EventSubscriber\\SessionCookieDedupSubscriber'] ?? ($this->services['App\\EventSubscriber\\SessionCookieDedupSubscriber'] = new \App\EventSubscriber\SessionCookieDedupSubscriber()));
  10.         }, => 'onKernelResponse'], -1010);
  11.         $instance->addListener('kernel.request', [=> function () {
  1.             foreach ($listeners as &$listener) {
  2.                 $closure = &$this->optimized[$eventName][];
  3.                 if (\is_array($listener) && isset($listener[0]) && $listener[0] instanceof \Closure && >= \count($listener)) {
  4.                     $closure = static function (...$args) use (&$listener, &$closure) {
  5.                         if ($listener[0] instanceof \Closure) {
  6.                             $listener[0] = $listener[0]();
  7.                             $listener[1] = $listener[1] ?? '__invoke';
  8.                         }
  9.                         ($closure \Closure::fromCallable($listener))(...$args);
  10.                     };
  11.                 } else {
in /var/www/betbit-new/app/vendor/symfony/event-dispatcher/EventDispatcher.php :: Symfony\Component\EventDispatcher\{closure} (line 230)
  1.         foreach ($listeners as $listener) {
  2.             if ($stoppable && $event->isPropagationStopped()) {
  3.                 break;
  4.             }
  5.             $listener($event$eventName$this);
  6.         }
  7.     }
  8.     /**
  9.      * Sorts the internal list of listeners for the given event by priority.
  1.         } else {
  2.             $listeners $this->getListeners($eventName);
  3.         }
  4.         if ($listeners) {
  5.             $this->callListeners($listeners$eventName$event);
  6.         }
  7.         return $event;
  8.     }
  1.         try {
  2.             $this->beforeDispatch($eventName$event);
  3.             try {
  4.                 $e $this->stopwatch->start($eventName'section');
  5.                 try {
  6.                     $this->dispatcher->dispatch($event$eventName);
  7.                 } finally {
  8.                     if ($e->isStarted()) {
  9.                         $e->stop();
  10.                     }
  11.                 }
  1.     /**
  2.      * {@inheritdoc}
  3.      */
  4.     public function terminate(Request $requestResponse $response)
  5.     {
  6.         $this->dispatcher->dispatch(new TerminateEvent($this$request$response), KernelEvents::TERMINATE);
  7.     }
  8.     /**
  9.      * @internal
  10.      */
  1.         }
  2.         $response->sendHeaders();
  3.         $response->sendContent();
  4.         $this->terminate($request$response);
  5.     }
  6.     /**
  7.      * Handles a request to convert it to a response.
  8.      *
  1.                         if ($hasRun) {
  2.                             throw $e;
  3.                         }
  4.                         $hasRun true;
  5.                         $kernel->terminateWithException($e$request);
  6.                     };
  7.                 }
  8.             } elseif ($event instanceof ConsoleEvent && $app $event->getCommand()->getApplication()) {
  9.                 $output $event->getOutput();
  10.                 if ($output instanceof ConsoleOutputInterface) {
in /var/www/betbit-new/app/vendor/symfony/error-handler/ErrorHandler.php :: Symfony\Component\HttpKernel\EventListener\{closure} (line 537)
  1.             $this->exceptionHandler null;
  2.         }
  3.         try {
  4.             if (null !== $exceptionHandler) {
  5.                 $exceptionHandler($exception);
  6.                 return;
  7.             }
  8.             $handlerException ??= $exception;
  9.         } catch (\Throwable $handlerException) {
ErrorHandler->handleException()

Stack Trace

UndefinedFunctionError
Symfony\Component\ErrorHandler\Error\UndefinedFunctionError:
Attempted to call function "bcadd" from namespace "App\Services\Fx".

  at /var/www/betbit-new/app/src/Services/Fx/FxSafetyBufferPolicy.php:142
  at App\Services\Fx\FxSafetyBufferPolicy->normalizePercent()
     (/var/www/betbit-new/app/src/Services/Fx/FxSafetyBufferPolicy.php:28)
  at App\Services\Fx\FxSafetyBufferPolicy->__construct()
     (/var/www/betbit-new/app/var/cache/dev/ContainerSxeEifr/App_KernelDevDebugContainer.php:10676)
  at ContainerSxeEifr\App_KernelDevDebugContainer->getFxSafetyBufferPolicyService()
     (/var/www/betbit-new/app/var/cache/dev/ContainerSxeEifr/App_KernelDevDebugContainer.php:10698)
  at ContainerSxeEifr\App_KernelDevDebugContainer->getFxServiceService()
     (/var/www/betbit-new/app/var/cache/dev/ContainerSxeEifr/App_KernelDevDebugContainer.php:10491)
  at ContainerSxeEifr\App_KernelDevDebugContainer->getPaymentFxServiceService()
     (/var/www/betbit-new/app/var/cache/dev/ContainerSxeEifr/App_KernelDevDebugContainer.php:11449)
  at ContainerSxeEifr\App_KernelDevDebugContainer->getPayadmitIntegrationServiceService()
     (/var/www/betbit-new/app/var/cache/dev/ContainerSxeEifr/App_KernelDevDebugContainer.php:7232)
  at ContainerSxeEifr\App_KernelDevDebugContainer->getPayadmitWebhookTerminateSubscriberService()
     (/var/www/betbit-new/app/var/cache/dev/ContainerSxeEifr/App_KernelDevDebugContainer.php:15422)
  at ContainerSxeEifr\App_KernelDevDebugContainer->ContainerSxeEifr\{closure}()
     (/var/www/betbit-new/app/vendor/symfony/event-dispatcher/EventDispatcher.php:267)
  at Symfony\Component\EventDispatcher\EventDispatcher::Symfony\Component\EventDispatcher\{closure}()
     (/var/www/betbit-new/app/vendor/symfony/event-dispatcher/EventDispatcher.php:230)
  at Symfony\Component\EventDispatcher\EventDispatcher->callListeners()
     (/var/www/betbit-new/app/vendor/symfony/event-dispatcher/EventDispatcher.php:59)
  at Symfony\Component\EventDispatcher\EventDispatcher->dispatch()
     (/var/www/betbit-new/app/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:154)
  at Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher->dispatch()
     (/var/www/betbit-new/app/vendor/symfony/http-kernel/HttpKernel.php:97)
  at Symfony\Component\HttpKernel\HttpKernel->terminate()
     (/var/www/betbit-new/app/vendor/symfony/http-kernel/HttpKernel.php:124)
  at Symfony\Component\HttpKernel\HttpKernel->terminateWithException()
     (/var/www/betbit-new/app/vendor/symfony/http-kernel/EventListener/DebugHandlersListener.php:132)
  at Symfony\Component\HttpKernel\EventListener\DebugHandlersListener::Symfony\Component\HttpKernel\EventListener\{closure}()
     (/var/www/betbit-new/app/vendor/symfony/error-handler/ErrorHandler.php:537)
  at Symfony\Component\ErrorHandler\ErrorHandler->handleException()