Server IP : 192.158.238.246 / Your IP : 18.221.142.39 Web Server : LiteSpeed System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64 User : jenniferflocom ( 1321) PHP Version : 8.1.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/7779/task/7779/cwd/plugins/give/src/DonationForms/V2/Properties/ |
Upload File : |
<?php namespace Give\DonationForms\V2\Properties; use Give\Framework\Support\ValueObjects\Money; final class DonationFormLevel { /** * @var int */ public $id; /** * @var Money */ public $amount; /** * @var string */ public $label; /** * @var bool */ public $isDefault; /** * @since 2.24.0 * * @param array $array * * @return DonationFormLevel */ public static function fromArray(array $array): DonationFormLevel { $self = new static(); $self->id = $array['_give_id']['level_id']; $self->amount = Money::fromDecimal($array['_give_amount'], give_get_currency()); $self->label = $array['_give_text'] ?? ''; $self->isDefault = isset($array['_give_default']) && $array['_give_default'] === 'default'; return $self; } /** * @since 2.24.0 * * @param string $price * * @return DonationFormLevel */ public static function fromPrice(string $price): DonationFormLevel { $self = new static(); $self->id = 0; $self->amount = Money::fromDecimal($price, give_get_currency()); $self->label = ''; $self->isDefault = true; return $self; } }