Scalr\Service\Aws\DataType\ListDataType::__construct PHP Метод

__construct() публичный Метод

Constructor
public __construct ( string | array | object $aListData = null, string | array $propertyName = null, string $dataClassName = null )
$aListData string | array | object 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.
$propertyName string | array optional A public property name of the object that is used as out for query string.
$dataClassName string 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);
                }
            }
        }
    }