protected function generateHashArray($parent, array $hashArray) { $object = new Object($parent); foreach ($hashArray as $hashKey => $hashItem) { $object->{$hashKey} = $this->generateValue($object, $hashItem); } return $object; }