function addArray($array, $indent)
 {
     $key = key($array);
     if (!isset($array[$key])) {
         return FALSE;
     }
     if ($array[$key] === array()) {
         $array[$key] = '';
     }
     $value = $array[$key];
     $tempPath = tx_rnbase_util_Spyc::flatten($this->path);
     eval('$_arr = $this->result' . $tempPath . ';');
     if ($this->_containsGroupAlias) {
         do {
             if (!isset($this->SavedGroups[$this->_containsGroupAlias])) {
                 echo "Bad group name: {$this->_containsGroupAlias}.";
                 break;
             }
             $groupPath = $this->SavedGroups[$this->_containsGroupAlias];
             eval('$value = $this->result' . tx_rnbase_util_Spyc::flatten($groupPath) . ';');
         } while (FALSE);
         $this->_containsGroupAlias = FALSE;
     }
     // Adding string or numeric key to the innermost level or $this->arr.
     if ($key) {
         $_arr[$key] = $value;
     } else {
         if (!is_array($_arr)) {
             $_arr = array($value);
             $key = 0;
         } else {
             $_arr[] = $value;
             end($_arr);
             $key = key($_arr);
         }
     }
     $this->path[$indent] = $key;
     eval('$this->result' . $tempPath . ' = $_arr;');
     if ($this->_containsGroupAnchor) {
         $this->SavedGroups[$this->_containsGroupAnchor] = $this->path;
         $this->_containsGroupAnchor = FALSE;
     }
 }
 /**
  * Converts a YAML to a model mock
  *
  * YAML example:
  * _model: Tx_Rnbase_Domain_Model_Base
  * _record:
  *   uid: 3
  * getCategory:
  *   _model: Tx_Rnbase_Domain_Model_Data
  *   _record:
  *     uid: 5
  * getCategories:
  *   -
  *     _model: Tx_Rnbase_Domain_Model_Data
  *     _record:
  *       uid: 12
  *   -
  *     _model: Tx_Rnbase_Domain_Model_Data
  *     _record:
  *       uid: 13
  *
  * @param mixed $data Usually the yaml file
  *
  * @return tx_rnbase_model_base|PHPUnit_Framework_MockObject_MockObject
  */
 protected function loadYaml($data, $tryToLoadYamlFile = TRUE)
 {
     // there is no array, so convert the yaml content or file
     if ($tryToLoadYamlFile && !is_array($data)) {
         tx_rnbase::load('tx_rnbase_util_Spyc');
         $data = tx_rnbase_util_Spyc::YAMLLoad($data);
     }
     // we have an model
     if (isset($data['_model'])) {
         // find all getter methods to mock.
         $getters = $this->yamlFindGetters($data);
         $clazz = empty($data['_model']) ? 'tx_rnbase_model_base' : $data['_model'];
         tx_rnbase::load($clazz);
         $model = $this->getModel((array) $data['_record'], $clazz, $getters);
         // mock the getters and return the value from the nested yaml
         foreach ($getters as $getter) {
             $model->expects(self::any())->method($getter)->will($this->returnValue($this->loadYaml($data[$getter], FALSE)));
         }
         return $model;
     } elseif (is_array($data)) {
         $array = array();
         foreach ($data as $field => $value) {
             if (is_array($value)) {
                 $value = $this->loadYaml($value);
             }
             $array[$field] = $value;
         }
         return $array;
     }
     // else: return the data only
     return $data;
 }