コード例 #1
0
 /**
  * Converts the given mixed data into an hashArray
  * Method taken from tx_div
  *
  * @param   mixed       data to be converted
  * @param   string      string of characters used to split first argument
  * @return  array       an hashArray
  */
 private static function toHashArray($mixed, $splitCharacters = ',;:\\s')
 {
     if (is_string($mixed)) {
         tx_rnbase::load('tx_rnbase_util_Misc');
         $array = tx_rnbase_util_Misc::explode($mixed, $splitCharacters);
         // TODO: Enable empty values by defining a better explode functions.
         for ($i = 0, $len = count($array); $i < $len; $i = $i + 2) {
             $hashArray[$array[$i]] = $array[$i + 1];
         }
     } elseif (is_array($mixed)) {
         $hashArray = $mixed;
     } elseif (is_object($mixed) && method_exists($mixed, 'getArrayCopy')) {
         $hashArray = $mixed->getArrayCopy();
     } else {
         $hashArray = array();
     }
     return $hashArray;
 }