<?php

namespace patest\StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for Payment.CancellationPaymentMethodSet StructType
 * @subpackage Structs
 */
class Payment_CancellationPaymentMethodSet extends AnyEntity
{
    /**
     * The CancellationPaymentMethods
     * Meta information extracted from the WSDL
     * - minOccurs: 0
     * - nillable: true
     * @var \patest\StructType\RecordSetOfPayment_CancellationPaymentMethod
     */
    public $CancellationPaymentMethods;
    /**
     * The Id
     * Meta information extracted from the WSDL
     * - minOccurs: 0
     * - nillable: true
     * @var int
     */
    public $Id;
    /**
     * Constructor method for Payment.CancellationPaymentMethodSet
     * @uses Payment_CancellationPaymentMethodSet::setCancellationPaymentMethods()
     * @uses Payment_CancellationPaymentMethodSet::setId()
     * @param \patest\StructType\RecordSetOfPayment_CancellationPaymentMethod $cancellationPaymentMethods
     * @param int $id
     */
    public function __construct(\patest\StructType\RecordSetOfPayment_CancellationPaymentMethod $cancellationPaymentMethods = null, $id = null)
    {
        $this
            ->setCancellationPaymentMethods($cancellationPaymentMethods)
            ->setId($id);
    }
    /**
     * Get CancellationPaymentMethods value
     * An additional test has been added (isset) before returning the property value as
     * this property may have been unset before, due to the fact that this property is
     * removable from the request (nillable=true+minOccurs=0)
     * @return \patest\StructType\RecordSetOfPayment_CancellationPaymentMethod|null
     */
    public function getCancellationPaymentMethods()
    {
        return isset($this->CancellationPaymentMethods) ? $this->CancellationPaymentMethods : null;
    }
    /**
     * Set CancellationPaymentMethods value
     * This property is removable from request (nillable=true+minOccurs=0), therefore
     * if the value assigned to this property is null, it is removed from this object
     * @param \patest\StructType\RecordSetOfPayment_CancellationPaymentMethod $cancellationPaymentMethods
     * @return \patest\StructType\Payment_CancellationPaymentMethodSet
     */
    public function setCancellationPaymentMethods(\patest\StructType\RecordSetOfPayment_CancellationPaymentMethod $cancellationPaymentMethods = null)
    {
        if (is_null($cancellationPaymentMethods) || (is_array($cancellationPaymentMethods) && empty($cancellationPaymentMethods))) {
            unset($this->CancellationPaymentMethods);
        } else {
            $this->CancellationPaymentMethods = $cancellationPaymentMethods;
        }
        return $this;
    }
    /**
     * Get Id value
     * An additional test has been added (isset) before returning the property value as
     * this property may have been unset before, due to the fact that this property is
     * removable from the request (nillable=true+minOccurs=0)
     * @return int|null
     */
    public function getId()
    {
        return isset($this->Id) ? $this->Id : null;
    }
    /**
     * Set Id value
     * This property is removable from request (nillable=true+minOccurs=0), therefore
     * if the value assigned to this property is null, it is removed from this object
     * @param int $id
     * @return \patest\StructType\Payment_CancellationPaymentMethodSet
     */
    public function setId($id = null)
    {
        // validation for constraint: int
        if (!is_null($id) && !(is_int($id) || ctype_digit($id))) {
            throw new \InvalidArgumentException(sprintf('Invalid value %s, please provide an integer value, %s given', var_export($id, true), gettype($id)), __LINE__);
        }
        if (is_null($id) || (is_array($id) && empty($id))) {
            unset($this->Id);
        } else {
            $this->Id = $id;
        }
        return $this;
    }
}
