File "LoyaltyProgramAccrualRuleItemVariationData.php"

Full path: /home/capoeirajd/www/wp-content/plugins/wpforms-lite/vendor_prefixed/square/square/src/Models/LoyaltyProgramAccrualRuleItemVariationData.php
File size: 1.71 B
MIME-type: text/x-php
Charset: utf-8

Download   Open   Edit   Advanced Editor   Back

<?php

declare (strict_types=1);
namespace WPForms\Vendor\Square\Models;

use stdClass;
/**
 * Represents additional data for rules with the `ITEM_VARIATION` accrual type.
 */
class LoyaltyProgramAccrualRuleItemVariationData implements \JsonSerializable
{
    /**
     * @var string
     */
    private $itemVariationId;
    /**
     * @param string $itemVariationId
     */
    public function __construct(string $itemVariationId)
    {
        $this->itemVariationId = $itemVariationId;
    }
    /**
     * Returns Item Variation Id.
     * The ID of the `ITEM_VARIATION` [catalog object](entity:CatalogObject) that buyers can purchase to
     * earn
     * points.
     */
    public function getItemVariationId() : string
    {
        return $this->itemVariationId;
    }
    /**
     * Sets Item Variation Id.
     * The ID of the `ITEM_VARIATION` [catalog object](entity:CatalogObject) that buyers can purchase to
     * earn
     * points.
     *
     * @required
     * @maps item_variation_id
     */
    public function setItemVariationId(string $itemVariationId) : void
    {
        $this->itemVariationId = $itemVariationId;
    }
    /**
     * Encode this object to JSON
     *
     * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields
     *        are set. (default: false)
     *
     * @return array|stdClass
     */
    #[\ReturnTypeWillChange]
    public function jsonSerialize(bool $asArrayWhenEmpty = \false)
    {
        $json = [];
        $json['item_variation_id'] = $this->itemVariationId;
        $json = \array_filter($json, function ($val) {
            return $val !== null;
        });
        return !$asArrayWhenEmpty && empty($json) ? new stdClass() : $json;
    }
}