private function serializeField($value)
    {
        if (is_string($value)) {
            // @todo Could be decimal (D) or byte array (x)
            // @see https://github.com/recoilphp/amqp/issues/25
            return 'S' . $this->serializeLongString($value);
        }
        if (is_int($value)) {
            // @todo Could be timestamp (T)
            // @see https://github.com/recoilphp/amqp/issues/25
            if ($value >= 0) {
                if ($value < 0x80) {
                    return 'b' . $this->serializeSignedInt8($value);
                }
                if ($value < 0x8000) {
                    return 's' . $this->serializeSignedInt16($value);
                }
                if ($value < 0x80000000) {
                    return 'I' . $this->serializeSignedInt32($value);
                }
            } else {
                if ($value >= -0x80) {
                    return 'b' . $this->serializeSignedInt8($value);
                }
                if ($value >= -0x8000) {
                    return 's' . $this->serializeSignedInt16($value);
                }
                if ($value >= -0x80000000) {
                    return 'I' . $this->serializeSignedInt32($value);
                }
            }

            return 'l' . $this->serializeSignedInt64($value);
        }
        if (true === $value) {
            return "t\x01";
        }
        if (false === $value) {
            return "t\x00";
        }
        if (null === $value) {
            return 'V';
        }
        if (is_float($value)) {
            return 'd' . $this->serializeDouble($value);
        }
        if (is_array($value)) {
            return $this->serializeArrayOrTable($value);
        }
        throw new InvalidArgumentException(
            'Could not serialize value (' . chr($value) . ').'
        );
    }
private function serializeField($value)
    {
        if (is_string($value)) {
            // @todo Could be decimal (D) or byte array (x)
            // @see https://github.com/recoilphp/amqp/issues/25
            return 'S' . $this->serializeLongString($value);
        }
        if (is_int($value)) {
            // @todo Could be timestamp (T)
            // @see https://github.com/recoilphp/amqp/issues/25
            if ($value >= 0) {
                if ($value < 0x80) {
                    return 'b' . $this->serializeSignedInt8($value);
                }
                if ($value < 0x8000) {
                    return 's' . $this->serializeSignedInt16($value);
                }
                if ($value < 0x80000000) {
                    return 'I' . $this->serializeSignedInt32($value);
                }
            } else {
                if ($value >= -0x80) {
                    return 'b' . $this->serializeSignedInt8($value);
                }
                if ($value >= -0x8000) {
                    return 's' . $this->serializeSignedInt16($value);
                }
                if ($value >= -0x80000000) {
                    return 'I' . $this->serializeSignedInt32($value);
                }
            }

            return 'l' . $this->serializeSignedInt64($value);
        }
        if (true === $value) {
            return "t\x01";
        }
        if (false === $value) {
            return "t\x00";
        }
        if (null === $value) {
            return 'V';
        }
        if (is_float($value)) {
            return 'd' . $this->serializeDouble($value);
        }
        if (is_array($value)) {
            return $this->serializeArrayOrTable($value);
        }
        throw new InvalidArgumentException(
            'Could not serialize value (' . chr($value) . ').'
        );
    }
private function serializeField ( $ value ) { if ( is_string ( $ value ) ) { // @todo Could be decimal (D) or byte array (x) // @see https://github.com/recoilphp/amqp/issues/25 return 'S' . $ this -> serializeLongString ( $ value ) ; } if ( is_int ( $ value ) ) { // @todo Could be timestamp (T) // @see https://github.com/recoilphp/amqp/issues/25 if ( $ value >= 0 ) { if ( $ value < 0x80 ) { return 'b' . $ this -> serializeSignedInt8 ( $ value ) ; } if ( $ value < 0x8000 ) { return 's' . $ this -> serializeSignedInt16 ( $ value ) ; } if ( $ value < 0x80000000 ) { return 'I' . $ this -> serializeSignedInt32 ( $ value ) ; } } else { if ( $ value >= - 0x80 ) { return 'b' . $ this -> serializeSignedInt8 ( $ value ) ; } if ( $ value >= - 0x8000 ) { return 's' . $ this -> serializeSignedInt16 ( $ value ) ; } if ( $ value >= - 0x80000000 ) { return 'I' . $ this -> serializeSignedInt32 ( $ value ) ; } } return 'l' . $ this -> serializeSignedInt64 ( $ value ) ; } if ( true === $ value ) { return "t\x01" ; } if ( false === $ value ) { return "t\x00" ; } if ( null === $ value ) { return 'V' ; } if ( is_float ( $ value ) ) { return 'd' . $ this -> serializeDouble ( $ value ) ; } if ( is_array ( $ value ) ) { return $ this -> serializeArrayOrTable ( $ value ) ; } throw new InvalidArgumentException ( 'Could not serialize value (' . chr ( $ value ) . ').' ) ; }
Serialize a table or array field.

@param mixed $value

@return string The serialized value.
@throws \InvalidArgumentException
Serialize a table or array field .