<?php
use \WsdlToPhp\PackageBase\AbstractStructBase;

/**
 * This class stands for RealizacjeReceptWPakiecieMT StructType
 * @subpackage Structs
 */
class RealizacjeReceptWPakiecieMT extends AbstractStructBase
{
    /**
     * The realizacja
     * Meta information extracted from the WSDL
     * - maxOccurs: unbounded
     * - minOccurs: 1
     * @var RealizacjaReceptyWPakiecieMT[]
     */
    public $realizacja;
    /**
     * Constructor method for RealizacjeReceptWPakiecieMT
     * @uses RealizacjeReceptWPakiecieMT::setRealizacja()
     * @param RealizacjaReceptyWPakiecieMT[] $realizacja
     */
    public function __construct(array $realizacja = array())
    {
        $this
            ->setRealizacja($realizacja);
    }
    /**
     * Get realizacja value
     * @return RealizacjaReceptyWPakiecieMT[]
     */
    public function getRealizacja()
    {
        return $this->realizacja;
    }
    /**
     * This method is responsible for validating the values passed to the setRealizacja method
     * This method is willingly generated in order to preserve the one-line inline validation within the setRealizacja method
     * @param array $values
     * @return string A non-empty message if the values does not match the validation rules
     */
    public static function validateRealizacjaForArrayConstraintsFromSetRealizacja(array $values = array())
    {
        $message = '';
        $invalidValues = [];
        foreach ($values as $realizacjeReceptWPakiecieMTRealizacjaItem) {
            // validation for constraint: itemType
            if (!$realizacjeReceptWPakiecieMTRealizacjaItem instanceof RealizacjaReceptyWPakiecieMT) {
                $invalidValues[] = is_object($realizacjeReceptWPakiecieMTRealizacjaItem) ? get_class($realizacjeReceptWPakiecieMTRealizacjaItem) : sprintf('%s(%s)', gettype($realizacjeReceptWPakiecieMTRealizacjaItem), var_export($realizacjeReceptWPakiecieMTRealizacjaItem, true));
            }
        }
        if (!empty($invalidValues)) {
            $message = sprintf('The realizacja property can only contain items of type RealizacjaReceptyWPakiecieMT, %s given', is_object($invalidValues) ? get_class($invalidValues) : (is_array($invalidValues) ? implode(', ', $invalidValues) : gettype($invalidValues)));
        }
        unset($invalidValues);
        return $message;
    }
    /**
     * Set realizacja value
     * @throws \InvalidArgumentException
     * @param RealizacjaReceptyWPakiecieMT[] $realizacja
     * @return RealizacjeReceptWPakiecieMT
     */
    public function setRealizacja(array $realizacja = array())
    {
        // validation for constraint: array
        if ('' !== ($realizacjaArrayErrorMessage = self::validateRealizacjaForArrayConstraintsFromSetRealizacja($realizacja))) {
            throw new \InvalidArgumentException($realizacjaArrayErrorMessage, __LINE__);
        }
        $this->realizacja = $realizacja;
        return $this;
    }
    /**
     * Add item to realizacja value
     * @throws \InvalidArgumentException
     * @param RealizacjaReceptyWPakiecieMT $item
     * @return RealizacjeReceptWPakiecieMT
     */
    public function addToRealizacja(RealizacjaReceptyWPakiecieMT $item)
    {
        // validation for constraint: itemType
        if (!$item instanceof RealizacjaReceptyWPakiecieMT) {
            throw new \InvalidArgumentException(sprintf('The realizacja property can only contain items of type RealizacjaReceptyWPakiecieMT, %s given', is_object($item) ? get_class($item) : (is_array($item) ? implode(', ', $item) : gettype($item))), __LINE__);
        }
        $this->realizacja[] = $item;
        return $this;
    }
}
