/** * Constructor * * @param string|array|object $aListData An array or single element of the list. It can be array of * the objects of dataClassName class or a single object of * the mentioned class. * @param string|array $propertyName optional A public property name of the object that is used as * out for query string. * @param string $dataClassName optional A data class name of the objects which form a list. */ public function __construct($aListData = null, $propertyName = null, $dataClassName = null) { parent::__construct(); $this->aListData = $aListData === null ? array() : (!is_array($aListData) ? $aListData instanceof self ? $aListData->getComputed() : array($aListData) : $aListData); $this->dataClassName = $dataClassName; $this->propertyName = $propertyName; //It turns strings or arrays into dataClass objects and set appropriate properties. if ($this->dataClassName != null) { if (is_array($this->propertyName) && count($this->propertyName) == 0) { throw new \InvalidArgumentException('Invalid propertyName argument. It must not be empty.'); } foreach ($this->aListData as $k => $v) { $t = $this->typeCastData($v); if ($t !== null) { $this->aListData[$k] = $t; unset($t); } } } }