Source of file ReadLabelLayouts.php
Size: 4,554 Bytes - Last Modified: 2019-01-11T00:06:02+01:00
/Users/sylvainraye/Sites/git/swisspost/src/StructType/ReadLabelLayouts.php
| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 | <?phpnamespace Diglin\Swisspost\StructType; use \WsdlToPhp\PackageBase\AbstractStructBase; /** * This class stands for ReadLabelLayouts StructType * @subpackage Structs * @date 2019/01/11 * @codeVersion 1.0.0 */class ReadLabelLayouts extends AbstractStructBase {/** * The Language * @var string */public $Language; /** * The PRZL * Meta informations extracted from the WSDL * - maxOccurs: unbounded * - documentation: Identifies a PRZL. * - pattern: [a-zA-Z,0-9]{1,10} * @var string[] */public $PRZL; /** * Constructor method for ReadLabelLayouts * @uses ReadLabelLayouts::setLanguage() * @uses ReadLabelLayouts::setPRZL() * @param string $language * @param string[] $pRZL */public function __construct($language = null, array $pRZL = array()) { $this ->setLanguage($language) ->setPRZL($pRZL); } /** * Get Language value * @return string|null */public function getLanguage() { return $this->Language; } /** * Set Language value * @uses \Diglin\Swisspost\EnumType\Language::valueIsValid() * @uses \Diglin\Swisspost\EnumType\Language::getValidValues() * @throws \InvalidArgumentException * @param string $language * @return \Diglin\Swisspost\StructType\ReadLabelLayouts */public function setLanguage($language = null) { // validation for constraint: enumeration if (!\Diglin\Swisspost\EnumType\Language::valueIsValid($language)) { throw new \InvalidArgumentException(sprintf('Value "%s" is invalid, please use one of: %s', $language, implode(', ', \Diglin\Swisspost\EnumType\Language::getValidValues())), __LINE__); } $this->Language = $language; return $this; } /** * Get PRZL value * @return string[]|null */public function getPRZL() { return $this->PRZL; } /** * Set PRZL value * @throws \InvalidArgumentException * @param string[] $pRZL * @return \Diglin\Swisspost\StructType\ReadLabelLayouts */public function setPRZL(array $pRZL = array()) { // validation for constraint: pattern if (is_scalar($pRZL) && !preg_match('/[a-zA-Z,0-9]{1,10}/', $pRZL)) { throw new \InvalidArgumentException(sprintf('Invalid value, please provide a scalar value that matches "[a-zA-Z,0-9]{1,10}", "%s" given', var_export($pRZL, true)), __LINE__); } foreach ($pRZL as $readLabelLayoutsPRZLItem) { // validation for constraint: itemType if (!is_string($readLabelLayoutsPRZLItem)) { throw new \InvalidArgumentException(sprintf('The PRZL property can only contain items of string, "%s" given', is_object($readLabelLayoutsPRZLItem) ? get_class($readLabelLayoutsPRZLItem) : gettype($readLabelLayoutsPRZLItem)), __LINE__); } } $this->PRZL = $pRZL; return $this; } /** * Add item to PRZL value * @throws \InvalidArgumentException * @param string $item * @return \Diglin\Swisspost\StructType\ReadLabelLayouts */public function addToPRZL($item) { // validation for constraint: pattern if (is_scalar($item) && !preg_match('/[a-zA-Z,0-9]{1,10}/', $item)) { throw new \InvalidArgumentException(sprintf('Invalid value, please provide a scalar value that matches "[a-zA-Z,0-9]{1,10}", "%s" given', var_export($item, true)), __LINE__); } // validation for constraint: itemType if (!is_string($item)) { throw new \InvalidArgumentException(sprintf('The PRZL property can only contain items of string, "%s" given', is_object($item) ? get_class($item) : gettype($item)), __LINE__); } $this->PRZL[] = $item; 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 \Diglin\Swisspost\StructType\ReadLabelLayouts */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__; } } |