function handleArray($array) { if (empty($array)) { return 'N'; } $refindex = $this->refmap->getReference($array); if ($refindex !== false) { return $this->writeReference($refindex); } if (HessianUtils::isListFormula($array)) { return $this->writeList($array); } return $this->writeMap($array); }
function writeArray($array) { if (empty($array)) { return 'N'; } $refindex = $this->refmap->getReference($array); if ($refindex !== false) { return $this->writeReference($refindex); } /* ::= x57 value* 'Z' # variable-length untyped list ::= x58 int value* # fixed-length untyped list ::= [x78-7f] value* # fixed-length untyped list */ $total = count($array); if (HessianUtils::isListFormula($array)) { $this->refmap->objectlist[] =& $array; $stream = ''; if ($total <= 7) { $len = $total + 0x78; $stream = pack('c', $len); } else { $stream = pack('c', 0x58); $stream .= $this->writeInt($total); } foreach ($array as $key => $value) { $stream .= $this->writeValue($value); } return $stream; } else { return $this->writeMap($array); } }