<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for UnapprovedKeyAccessStructure StructType
 * Meta informations extracted from the WSDL
 * - documentation: Type for Error: UnapprovedKey +SIRI v2.0
 * @subpackage Structs
 */
class UnapprovedKeyAccessStructure extends ErrorCodeStructure
{
    /**
     * The Key
     * Meta informations extracted from the WSDL
     * - documentation: User key.
     * - minOccurs: 0
     * @var string
     */
    public $Key;
    /**
     * Constructor method for UnapprovedKeyAccessStructure
     * @uses UnapprovedKeyAccessStructure::setKey()
     * @param string $key
     */
    public function __construct($key = null)
    {
        $this
            ->setKey($key);
    }
    /**
     * Get Key value
     * @return string|null
     */
    public function getKey()
    {
        return $this->Key;
    }
    /**
     * Set Key value
     * @param string $key
     * @return \StructType\UnapprovedKeyAccessStructure
     */
    public function setKey($key = null)
    {
        // validation for constraint: string
        if (!is_null($key) && !is_string($key)) {
            throw new \InvalidArgumentException(sprintf('Invalid value, please provide a string, "%s" given', gettype($key)), __LINE__);
        }
        $this->Key = $key;
        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 \StructType\UnapprovedKeyAccessStructure
     */
    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__;
    }
}
