<?php

namespace OXModule\StructClass;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for RemoteException StructClass
 * @subpackage Structs
 */
class RemoteException extends IOException
{
    /**
     * The RemoteException
     * Meta informations extracted from the WSDL
     * - minOccurs: 0
     * - nillable: true
     * @var \OXModule\StructClass\RemoteException
     */
    public $RemoteException;
    /**
     * The message
     * Meta informations extracted from the WSDL
     * - minOccurs: 0
     * - nillable: true
     * @var string
     */
    public $message;
    /**
     * Constructor method for RemoteException
     * @uses RemoteException::setRemoteException()
     * @uses RemoteException::setMessage()
     * @param \OXModule\StructClass\RemoteException $remoteException
     * @param string $message
     */
    public function __construct(\OXModule\StructClass\RemoteException $remoteException = null, $message = null)
    {
        $this
            ->setRemoteException($remoteException)
            ->setMessage($message);
    }
    /**
     * Get RemoteException 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 \OXModule\StructClass\RemoteException|null
     */
    public function getRemoteException()
    {
        return isset($this->RemoteException) ? $this->RemoteException : null;
    }
    /**
     * Set RemoteException 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 \OXModule\StructClass\RemoteException $remoteException
     * @return \OXModule\StructClass\RemoteException
     */
    public function setRemoteException(\OXModule\StructClass\RemoteException $remoteException = null)
    {
        if (is_null($remoteException) || (is_array($remoteException) && empty($remoteException))) {
            unset($this->RemoteException);
        } else {
            $this->RemoteException = $remoteException;
        }
        return $this;
    }
    /**
     * Get message 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 string|null
     */
    public function getMessage()
    {
        return isset($this->message) ? $this->message : null;
    }
    /**
     * Set message 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 string $message
     * @return \OXModule\StructClass\RemoteException
     */
    public function setMessage($message = null)
    {
        // validation for constraint: string
        if (!is_null($message) && !is_string($message)) {
            throw new \InvalidArgumentException(sprintf('Invalid value, please provide a string, "%s" given', gettype($message)), __LINE__);
        }
        if (is_null($message) || (is_array($message) && empty($message))) {
            unset($this->message);
        } else {
            $this->message = $message;
        }
        return $this;
    }
    /**
     * Method called when an object has been exported with var_export() functions
     * It allows to return an object instantiated with the values
     * @see AbstractStructBase::__set_state()
     * @uses AbstractStructBase::__set_state()
     * @param array $array the exported values
     * @return \OXModule\StructClass\RemoteException
     */
    public static function __set_state(array $array)
    {
        return parent::__set_state($array);
    }
    /**
     * Method returning the class name
     * @return string __CLASS__
     */
    public function __toString()
    {
        return __CLASS__;
    }
}
