public function map($callback) { $data =& $this->getValue(); if ($data != null && is_array($data)) { $toMap =& $data; } else { $toMap = array($data); } $mapped = new ValueWrapper(array()); foreach ($toMap as $key => $value) { $mappedVal = $callback($key, $value, new DataWrapper($this, $key), new ValueWrapperRef($value)); static::unwrapValue($mappedVal); $mapped->set($key, $mappedVal); } return $mapped; }