private function _serializePayload($payload)
    {
        if (empty($payload) || $this->serialize_payload_method === self::SERIALIZE_PAYLOAD_NEVER)
            return $payload;

        // When we are in "smart" mode, don't serialize strings/scalars, assume they are already serialized
        if ($this->serialize_payload_method === self::SERIALIZE_PAYLOAD_SMART && is_scalar($payload))
            return $payload;

        // Use a custom serializer if one is registered for this mime type
        if (isset($this->payload_serializers['*']) || isset($this->payload_serializers[$this->content_type])) {
            $key = isset($this->payload_serializers[$this->content_type]) ? $this->content_type : '*';
            return call_user_func($this->payload_serializers[$key], $payload);
        }

        return Httpful::get($this->content_type)->serialize($payload);
    }
private function _serializePayload($payload)
    {
        if (empty($payload) || $this->serialize_payload_method === self::SERIALIZE_PAYLOAD_NEVER)
            return $payload;

        // When we are in "smart" mode, don't serialize strings/scalars, assume they are already serialized
        if ($this->serialize_payload_method === self::SERIALIZE_PAYLOAD_SMART && is_scalar($payload))
            return $payload;

        // Use a custom serializer if one is registered for this mime type
        if (isset($this->payload_serializers['*']) || isset($this->payload_serializers[$this->content_type])) {
            $key = isset($this->payload_serializers[$this->content_type]) ? $this->content_type : '*';
            return call_user_func($this->payload_serializers[$key], $payload);
        }

        return Httpful::get($this->content_type)->serialize($payload);
    }
private function _serializePayload ( $ payload ) { if ( empty ( $ payload ) || $ this -> serialize_payload_method === self :: SERIALIZE_PAYLOAD_NEVER ) return $ payload ; // When we are in "smart" mode, don't serialize strings/scalars, assume they are already serialized if ( $ this -> serialize_payload_method === self :: SERIALIZE_PAYLOAD_SMART && is_scalar ( $ payload ) ) return $ payload ; // Use a custom serializer if one is registered for this mime type if ( isset ( $ this -> payload_serializers [ '*' ] ) || isset ( $ this -> payload_serializers [ $ this -> content_type ] ) ) { $ key = isset ( $ this -> payload_serializers [ $ this -> content_type ] ) ? $ this -> content_type : '*' ; return call_user_func ( $ this -> payload_serializers [ $ key ] , $ payload ) ; } return Httpful :: get ( $ this -> content_type ) -> serialize ( $ payload ) ; }
Turn payload from structured data into
a string based on the current Mime type.
This uses the auto_serialize option to determine
it's course of action.  See serialize method for more.
Renamed from _detectPayload to _serializePayload as of
2012-02-15.

Added in support for custom payload serializers.
The serialize_payload_method stuff still holds true though.
@see Request::registerPayloadSerializer()

@param mixed $payload
@return string
Turn payload from structured data into a string based on the current Mime type . This uses the auto_serialize option to determine it s course of action . See serialize method for more . Renamed from _detectPayload to _serializePayload as of 2012 - 02 - 15 .