Beispiel #1
0
 /**
  * @param int $type One of PhpAmqpLib_Wire_AMQPAbstractCollection::T_* constants
  * @param mixed $val
  */
 private function write_value($type, $val)
 {
     //This will find appropriate symbol for given data type for currently selected protocol
     //Also will raise an exception on unknown type
     $this->write(PhpAmqpLib_Wire_AMQPAbstractCollection::getSymbolForDataType($type));
     switch ($type) {
         case PhpAmqpLib_Wire_AMQPAbstractCollection::T_INT_SHORTSHORT:
             $this->write_signed_octet($val);
             break;
         case PhpAmqpLib_Wire_AMQPAbstractCollection::T_INT_SHORTSHORT_U:
             $this->write_octet($val);
             break;
         case PhpAmqpLib_Wire_AMQPAbstractCollection::T_INT_SHORT:
             $this->write_signed_short($val);
             break;
         case PhpAmqpLib_Wire_AMQPAbstractCollection::T_INT_SHORT_U:
             $this->write_short($val);
             break;
         case PhpAmqpLib_Wire_AMQPAbstractCollection::T_INT_LONG:
             $this->write_signed_long($val);
             break;
         case PhpAmqpLib_Wire_AMQPAbstractCollection::T_INT_LONG_U:
             $this->write_long($val);
             break;
         case PhpAmqpLib_Wire_AMQPAbstractCollection::T_INT_LONGLONG:
             $this->write_signed_longlong($val);
             break;
         case PhpAmqpLib_Wire_AMQPAbstractCollection::T_INT_LONGLONG_U:
             $this->write_longlong($val);
             break;
         case PhpAmqpLib_Wire_AMQPAbstractCollection::T_DECIMAL:
             $this->write_octet($val->e);
             $this->write_signed_long($val->n);
             break;
         case PhpAmqpLib_Wire_AMQPAbstractCollection::T_TIMESTAMP:
             $this->write_timestamp($val);
             break;
         case PhpAmqpLib_Wire_AMQPAbstractCollection::T_BOOL:
             $this->write_octet($val ? 1 : 0);
             break;
         case PhpAmqpLib_Wire_AMQPAbstractCollection::T_STRING_SHORT:
             $this->write_shortstr($val);
             break;
         case PhpAmqpLib_Wire_AMQPAbstractCollection::T_STRING_LONG:
             $this->write_longstr($val);
             break;
         case PhpAmqpLib_Wire_AMQPAbstractCollection::T_ARRAY:
             $this->write_array($val);
             break;
         case PhpAmqpLib_Wire_AMQPAbstractCollection::T_TABLE:
             $this->write_table($val);
             break;
         case PhpAmqpLib_Wire_AMQPAbstractCollection::T_VOID:
             break;
         default:
             throw new PhpAmqpLib_Exception_AMQPInvalidArgumentException(sprintf('Unsupported type "%s"', $type));
     }
 }