<?php

namespace StructType;

use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for JP_RentacarResultsBookingRules StructType
 * @subpackage Structs
 */
class JP_RentacarResultsBookingRules extends AbstractStructBase
{
    /**
     * The RentacarResultsBookingRules
     * Meta informations extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 0
     * @var \StructType\JP_RentacarRulesResult[]
     */
    public $RentacarResultsBookingRules;
    /**
     * Constructor method for JP_RentacarResultsBookingRules
     * @uses JP_RentacarResultsBookingRules::setRentacarResultsBookingRules()
     * @param \StructType\JP_RentacarRulesResult[] $rentacarResultsBookingRules
     */
    public function __construct(array $rentacarResultsBookingRules = array())
    {
        $this
            ->setRentacarResultsBookingRules($rentacarResultsBookingRules);
    }
    /**
     * Get RentacarResultsBookingRules value
     * @return \StructType\JP_RentacarRulesResult[]|null
     */
    public function getRentacarResultsBookingRules()
    {
        return $this->RentacarResultsBookingRules;
    }
    /**
     * Set RentacarResultsBookingRules value
     * @throws \InvalidArgumentException
     * @param \StructType\JP_RentacarRulesResult[] $rentacarResultsBookingRules
     * @return \StructType\JP_RentacarResultsBookingRules
     */
    public function setRentacarResultsBookingRules(array $rentacarResultsBookingRules = array())
    {
        foreach ($rentacarResultsBookingRules as $jP_RentacarResultsBookingRulesRentacarResultsBookingRulesItem) {
            // validation for constraint: itemType
            if (!$jP_RentacarResultsBookingRulesRentacarResultsBookingRulesItem instanceof \StructType\JP_RentacarRulesResult) {
                throw new \InvalidArgumentException(sprintf('The RentacarResultsBookingRules property can only contain items of \StructType\JP_RentacarRulesResult, "%s" given', is_object($jP_RentacarResultsBookingRulesRentacarResultsBookingRulesItem) ? get_class($jP_RentacarResultsBookingRulesRentacarResultsBookingRulesItem) : gettype($jP_RentacarResultsBookingRulesRentacarResultsBookingRulesItem)), __LINE__);
            }
        }
        $this->RentacarResultsBookingRules = $rentacarResultsBookingRules;
        return $this;
    }
    /**
     * Add item to RentacarResultsBookingRules value
     * @throws \InvalidArgumentException
     * @param \StructType\JP_RentacarRulesResult $item
     * @return \StructType\JP_RentacarResultsBookingRules
     */
    public function addToRentacarResultsBookingRules(\StructType\JP_RentacarRulesResult $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof \StructType\JP_RentacarRulesResult) {
            throw new \InvalidArgumentException(sprintf('The RentacarResultsBookingRules property can only contain items of \StructType\JP_RentacarRulesResult, "%s" given', is_object($item) ? get_class($item) : gettype($item)), __LINE__);
        }
        $this->RentacarResultsBookingRules[] = $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 \StructType\JP_RentacarResultsBookingRules
     */
    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__;
    }
}
