/** * @param string $key * @param ArrayOf $model * @param array $data * @throws \Exception */ public function decodeArrayOf($key, $model, $data) { if ($data == null) { $data = array(); } CodeGuard::checkTypeAndThrow($data, 'array'); $model->exchangeArray(array()); foreach ($data as $item) { if ($model->hasGenerator()) { $object = $model->generate($item); $this->_decode($object, $item, ''); $model[] = $object; } else { if (is_array($item)) { throw new \Exception("Must not decode array for value type '{$key}'"); } $model[] = $item; } } }