HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux mail.btech-izolacje.pl 5.15.0-140-generic #150-Ubuntu SMP Sat Apr 12 06:00:09 UTC 2025 x86_64
User: pewna6876 (1017)
PHP: 8.2.28
Disabled: NONE
Upload Files
File: /home/pewnabryka.pl/public_html/wp-content/plugins/vehica-core/app/Core/BaseCurrency.php
<?php


namespace Vehica\Core;


/**
 * Class BaseCurrency
 *
 * @package Vehica\Core
 */
class BaseCurrency
{
    public $code = '';
    public $decimal = 2;
    public $support = [];

    /**
     * BaseCurrency constructor.
     *
     * @param string $code
     * @param int $decimal
     * @param array $support
     */
    public function __construct($code, $decimal, $support)
    {
        $this->code = $code;
        $this->decimal = $decimal;
        $this->support = $support;
    }

    /**
     * @return BaseCurrency|false
     */
    public static function getSelected()
    {
        $currencyCode = vehicaApp('settings_config')->getPaymentCurrency();
        if (empty($currencyCode)) {
            return false;
        }

        return vehicaApp('base_currencies')->find(static function ($baseCurrency) use ($currencyCode) {
            /* @var BaseCurrency $baseCurrency */
            return $baseCurrency->code === $currencyCode;
        });
    }

    /**
     * @return bool
     */
    public function supportPayPal()
    {
        return in_array('paypal', $this->support, true);
    }

    /**
     * @return string
     */
    public function getSupportedPaymentIntegrationsString()
    {
        if (!$this->supportPayPal()) {
            return esc_html__(' (Stripe)', 'vehica-core');
        }

        return esc_html__(' (Stripe & PayPal)', 'vehica-core');
    }

}