/** * Convert dictionary to binary format and add it to the object table * @param CFDictionary $val The dict to convert * @return integer The position in the object table */ public function dictToBinary($val) { $saved_object_count = $this->writtenObjectCount++; $bdata = self::typeBytes("d", count($val->getValue())); // d=1101, type indicator for dictionary foreach ($val as $k => $v) { $str = new CFString($k); $key = $str->toBinary($this); $bdata .= self::packItWithSize($this->objectRefSize, $key); } foreach ($val as $k => $v) { $bval = $v->toBinary($this); $bdata .= self::packItWithSize($this->objectRefSize, $bval); } $this->objectTable[$saved_object_count] = $bdata; return $saved_object_count; }