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